summaryrefslogtreecommitdiff
path: root/alot/crypto.py
diff options
context:
space:
mode:
authorJohannes Kulick <kulick@hildensia.de>2012-12-15 16:40:45 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2013-02-19 10:10:08 +0000
commit3ec53efa8e2a966ca2d697de6281291549e72b30 (patch)
tree4a8b7a533ac29353000d78cae9c8004a4d9e4450 /alot/crypto.py
parent8202a29c97266b411517dac7b2ad48eeb59eaa5f (diff)
add function to list all keys
We need that for auto-completion
Diffstat (limited to 'alot/crypto.py')
-rw-r--r--alot/crypto.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/alot/crypto.py b/alot/crypto.py
index 82b76ecb..0b00564f 100644
--- a/alot/crypto.py
+++ b/alot/crypto.py
@@ -130,6 +130,18 @@ def get_key(keyid):
return key
+def list_keys(private=False):
+ """
+ Returns a list of all keys containing keyid.
+
+ :param keyid: The part we search for
+ :param private: Whether secret keys are listed
+ :rtype: list
+ """
+ ctx = gpgme.Context()
+ return ctx.keylist(None, private)
+
+
def detached_signature_for(plaintext_str, key=None):
"""
Signs the given plaintext string and returns the detached signature.