summaryrefslogtreecommitdiff
path: root/alot/crypto.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-03-12 11:12:56 -0700
committerDylan Baker <dylan@pnwbakers.com>2018-03-12 11:12:56 -0700
commitd3f87ad82432a773cc69808135454f6bb104880e (patch)
tree2597d3068ff0b017bb1ad2e3331f01c3fa4cafbb /alot/crypto.py
parent10b46df578f08f54f879d561ccc7d061569fa7b4 (diff)
parent9e2cd32ab0b7a1906c2cf47f594a70fcaf901502 (diff)
Merge branch 'master' into py3k
Diffstat (limited to 'alot/crypto.py')
-rw-r--r--alot/crypto.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/alot/crypto.py b/alot/crypto.py
index 9d7d89ec..247dbd19 100644
--- a/alot/crypto.py
+++ b/alot/crypto.py
@@ -218,13 +218,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):