summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alot/crypto.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/alot/crypto.py b/alot/crypto.py
index 4ebb72f7..34bdccb5 100644
--- a/alot/crypto.py
+++ b/alot/crypto.py
@@ -219,12 +219,15 @@ def decrypt_verify(encrypted):
"""
ctx = gpg.core.Context()
try:
- (plaintext, _, verify_result) = ctx.decrypt(encrypted, verify=True)
+ plaintext, _, verify_result = ctx.decrypt(encrypted, verify=True)
+ sigs = verify_result.signatures
except gpg.errors.GPGMEError as e:
raise GPGProblem(str(e), code=e.getcode())
- # what if the signature is bad?
+ except gpg.errors.BadSignatures as e:
+ plaintext, _, _ = ctx.decrypt(encrypted, verify=False)
+ sigs = e.result.signatures
- return verify_result.signatures, plaintext
+ return sigs, plaintext
def validate_key(key, sign=False, encrypt=False):