diff options
author | Lars Wirzenius <liw@liw.fi> | 2011-04-12 14:32:27 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2011-04-12 14:32:27 +0100 |
commit | e60cd19c63dab122724bd139a9440b9cb2b72646 (patch) | |
tree | ede3e6c4dd09a3b33d8ddfb9924ba97bd3f29fd4 | |
parent | 5196a2e83847a47d40689034a0dc5667988e7ce6 (diff) | |
download | obnam-e60cd19c63dab122724bd139a9440b9cb2b72646.tar.gz |
Add add-key subcommand.
-rw-r--r-- | obnamlib/plugins/encryption_plugin.py | 9 | ||||
-rwxr-xr-x | test-encrypted-repo | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/obnamlib/plugins/encryption_plugin.py b/obnamlib/plugins/encryption_plugin.py index f3da8947..b96fd6d9 100644 --- a/obnamlib/plugins/encryption_plugin.py +++ b/obnamlib/plugins/encryption_plugin.py @@ -42,6 +42,7 @@ class EncryptionPlugin(obnamlib.ObnamPlugin): self.app.register_command('client-keys', self.client_keys) self.app.register_command('list-keys', self.list_keys) self.app.register_command('list-toplevels', self.list_toplevels) + self.app.register_command('add-key', self.add_key) @property def keyid(self): @@ -147,6 +148,14 @@ class EncryptionPlugin(obnamlib.ObnamPlugin): for keyid in tops[toplevel]: print ' %s' % keyid + def add_key(self, args): + repo = self.app.open_repository() + shared = ['chunklist', 'chunks', 'chunksums', 'clientlist', 'metadata'] + for keyid in args: + key = obnamlib.get_public_key(keyid) + for toplevel in shared: + self.add_to_userkeys(repo, toplevel, key) + # def add_client(self, repo, client_public_key): # self.add_to_userkeys(repo, 'metadata', client_public_key) # self.add_to_userkeys(repo, 'clientlist', client_public_key) diff --git a/test-encrypted-repo b/test-encrypted-repo index 618232a2..5b305e8f 100755 --- a/test-encrypted-repo +++ b/test-encrypted-repo @@ -5,6 +5,8 @@ set -e cmd="./obnam --repository=temp.repo --log=temp.log --log-level=debug" cmd="$cmd --encrypt-with=1B321347" +key2="11E69900" + rm -rf temp.gpghome temp.data temp.repo temp.restored temp.log cp -a test-gpghome temp.gpghome @@ -19,6 +21,8 @@ $cmd restore --generation latest --to temp.restored summain -r temp.restored/$(pwd)/temp.data > temp.restored.manifest diff -u temp.data.manifest temp.restored.manifest +$cmd add-key $key2 + echo "client keys:" $cmd client-keys @@ -27,3 +31,8 @@ $cmd list-keys echo "list-toplevels:" $cmd list-toplevels + +#echo "remove key" +#$cmd remove-key $key2 +#$cmd list-keys + |