From 9d44862908f521850eaf420cfcdac733d030113d Mon Sep 17 00:00:00 2001 From: Thais Siqueira Date: Mon, 16 May 2016 17:38:46 -0300 Subject: [bug] verify signature of encrypted email from Apple Mail Fix verify signature on encrypted email from Apple Mail, adding a step to verify signature after decrypt the email because the keymananger could not verify signature when decrypting it --- mail/src/leap/mail/incoming/service.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mail/src/leap/mail/incoming/service.py b/mail/src/leap/mail/incoming/service.py index c7d194d..f60921a 100644 --- a/mail/src/leap/mail/incoming/service.py +++ b/mail/src/leap/mail/incoming/service.py @@ -524,10 +524,20 @@ class IncomingMail(Service): self._add_decrypted_header(msg) return (msg, signkey) + def verify_signature_after_decrypt_an_email(res): + decrdata, signkey = res + if not isinstance(signkey, OpenPGPKey): + try: + return self._verify_signature_not_encrypted_msg(decrdata, senderAddress) + except: + pass + return res + d = self._keymanager.decrypt( encdata, self._userid, OpenPGPKey, verify=senderAddress) d.addCallbacks(build_msg, self._decryption_error, errbackArgs=(msg,)) + d.addCallbacks(verify_signature_after_decrypt_an_email) return d def _maybe_decrypt_inline_encrypted_msg(self, origmsg, encoding, -- cgit v1.2.3