diff options
author | Lucas Hoffmann <l-m-h@web.de> | 2016-03-11 12:37:37 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2016-03-11 11:52:31 +0000 |
commit | 707ef0c77440d3fd7fef1e3b5bd6eb2240e4b251 (patch) | |
tree | 5d5fb254b489fb0db893fc608958dd16a5568d9b /alot/crypto.py | |
parent | 08ddb73351c47c053ebf983351ec235087491a25 (diff) |
Add and update several docstrings.
Diffstat (limited to 'alot/crypto.py')
-rw-r--r-- | alot/crypto.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/alot/crypto.py b/alot/crypto.py index d5931618..5565b890 100644 --- a/alot/crypto.py +++ b/alot/crypto.py @@ -219,10 +219,12 @@ def hash_key(key): """ Returns a hash of the given key. This is a workaround for https://bugs.launchpad.net/pygpgme/+bug/1089865 - and can be removed if the missing feature is added to pygpgme + and can be removed if the missing feature is added to pygpgme. :param key: the key we want a hash of - :rtype: a has of the key as string + :type key: gpgme.Key + :returns: a hash of the key + :rtype: str """ hash_str = "" for tmp_key in key.subkeys: @@ -231,6 +233,17 @@ def hash_key(key): def validate_key(key, sign=False, encrypt=False): + """Assert that a key is valide and optionally that it can be used for + signing or encrypting. Raise GPGProblem otherwise. + + :param key: the GPG key to check + :type key: gpgme.Key + :param sign: whether the key should be able to sign + :type sign: bool + :param encrypt: whether the key should be able to encrypt + :type encrypt: bool + + """ if key.revoked: raise GPGProblem("The key \"" + key.uids[0].uid + "\" is revoked.", code=GPGCode.KEY_REVOKED) |