summaryrefslogtreecommitdiff
path: root/obnamlib/encryption.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2013-09-06 19:59:10 +0100
committerLars Wirzenius <liw@liw.fi>2013-09-06 19:59:10 +0100
commit02e1087c4c29fe18c6a8d8af27cca75d7bd8be5c (patch)
tree07bc3f4165b1169ef72d37ec8c00c95a028d1889 /obnamlib/encryption.py
parent2a3a1e574f5be7161f147f65912d428768e4739f (diff)
downloadobnam-02e1087c4c29fe18c6a8d8af27cca75d7bd8be5c.tar.gz
Add --key-details option
Patch by Lars Kruse.
Diffstat (limited to 'obnamlib/encryption.py')
-rw-r--r--obnamlib/encryption.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/obnamlib/encryption.py b/obnamlib/encryption.py
index 3381c61f..9fa849a9 100644
--- a/obnamlib/encryption.py
+++ b/obnamlib/encryption.py
@@ -135,6 +135,18 @@ def get_public_key(keyid, gpghome=None):
return _gpg(['--export', '--armor', keyid], gpghome=gpghome)
+def get_public_key_user_ids(keyid, gpghome=None): # pragma: no cover
+ '''Return the ASCII armored export form of a given public key.'''
+ user_ids = []
+ output = _gpg(['--with-colons', '--list-keys', keyid], gpghome=gpghome)
+ for line in output.splitlines():
+ token = line.split(":")
+ if len(token) >= 10:
+ user_id = token[9].strip().replace(r'\x3a', ":")
+ if user_id:
+ user_ids.append(user_id)
+ return user_ids
+
class Keyring(object):