diff options
-rw-r--r-- | alot/commands/envelope.py | 2 | ||||
-rw-r--r-- | alot/commands/utils.py | 5 | ||||
-rw-r--r-- | alot/crypto.py | 17 |
3 files changed, 3 insertions, 21 deletions
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py index 0294dc01..36ebf9be 100644 --- a/alot/commands/envelope.py +++ b/alot/commands/envelope.py @@ -572,7 +572,7 @@ class EncryptCommand(Command): try: for keyid in self.encrypt_keys: tmp_key = crypto.get_key(keyid) - del envelope.encrypt_keys[crypto.hash_key(tmp_key)] + del envelope.encrypt_keys[tmp_key.fpr] except GPGProblem as e: ui.notify(e.message, priority='error') if not envelope.encrypt_keys: diff --git a/alot/commands/utils.py b/alot/commands/utils.py index ddfeec41..0aa80656 100644 --- a/alot/commands/utils.py +++ b/alot/commands/utils.py @@ -65,9 +65,8 @@ def _get_keys(ui, encrypt_keyids, block_error=False, signed_only=False): :param signed_only: only return keys whose uid is signed (trusted to belong to the key) :type signed_only: bool - :returns: the available keys indexed by their key hash + :returns: the available keys indexed by their OpenPGP fingerprint :rtype: dict(str->gpg key object) - """ keys = {} for keyid in encrypt_keyids: @@ -89,5 +88,5 @@ def _get_keys(ui, encrypt_keyids, block_error=False, signed_only=False): else: ui.notify(e.message, priority='error', block=block_error) continue - keys[crypto.hash_key(key)] = key + keys[key.fpr] = key returnValue(keys) diff --git a/alot/crypto.py b/alot/crypto.py index 3700aeef..7d62bb8a 100644 --- a/alot/crypto.py +++ b/alot/crypto.py @@ -218,23 +218,6 @@ def decrypt_verify(encrypted): return verify_result.signatures, plaintext -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. - - :param key: the key we want a hash of - :type key: gpgme.Key - :returns: a hash of the key - :rtype: str - """ - hash_str = "" - for tmp_key in key.subkeys: - hash_str += tmp_key.keyid - return hash_str - - 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. |