summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2016-11-30 02:32:46 -0500
committerDylan Baker <dylan@pnwbakers.com>2017-08-14 09:33:07 -0700
commitc552af6a8b5e5762a657ac554cf1d8b8db78ea90 (patch)
tree2d8bfc42d9894f6da22ce5dede2227e74bfa5bbd
parentb0e2f322aa571a5e1999c069779f589e282a566c (diff)
just use the OpenPGP fingerprint instead of inventing "hash_key"
-rw-r--r--alot/commands/envelope.py2
-rw-r--r--alot/commands/utils.py5
-rw-r--r--alot/crypto.py17
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.