summaryrefslogtreecommitdiff
path: root/mail
diff options
context:
space:
mode:
authorCaio Carrara <ccarrara@thoughtworks.com>2016-05-25 16:11:34 -0300
committerCaio Carrara <ccarrara@thoughtworks.com>2016-05-25 16:11:34 -0300
commit16257201db63a8f65b2afe278414690980d0d358 (patch)
tree904c49bb5aafebcf7ced9985b0b6d7de32738026 /mail
parent4c8cc737d205231c475000f2f7399262829630a3 (diff)
[refactor] change the check to validate signature from Apple Mail
It changes the way that incoming service checks if a additional verification is needed to validate signature. The way before was checking by the type of signature object and calling the verify signature method if the type is different from OpenPGPKey. However it could be more readable if we check the type of decrypted message. If it's a multipart/signed message and not a plain/text we need to verify the signature because keymanager couldn't do it during the decryption process.
Diffstat (limited to 'mail')
-rw-r--r--mail/src/leap/mail/incoming/service.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/mail/src/leap/mail/incoming/service.py b/mail/src/leap/mail/incoming/service.py
index bf850b57..58a19c81 100644
--- a/mail/src/leap/mail/incoming/service.py
+++ b/mail/src/leap/mail/incoming/service.py
@@ -530,11 +530,9 @@ class IncomingMail(Service):
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
+ if decrdata.get_content_type() == MULTIPART_SIGNED:
+ res = self._verify_signature_not_encrypted_msg(decrdata,
+ senderAddress)
return res
d = self._keymanager.decrypt(