diff options
Diffstat (limited to 'src/leap/mail/incoming')
-rw-r--r-- | src/leap/mail/incoming/service.py | 20 | ||||
-rw-r--r-- | src/leap/mail/incoming/tests/test_incoming_mail.py | 19 |
2 files changed, 14 insertions, 25 deletions
diff --git a/src/leap/mail/incoming/service.py b/src/leap/mail/incoming/service.py index c7d194d..0d49a40 100644 --- a/src/leap/mail/incoming/service.py +++ b/src/leap/mail/incoming/service.py @@ -40,7 +40,6 @@ from leap.common.events import emit_async, catalog from leap.common.check import leap_assert, leap_assert_type from leap.common.mail import get_email_charset from leap.keymanager import errors as keymanager_errors -from leap.keymanager.openpgp import OpenPGPKey from leap.mail.adaptors import soledad_indexes as fields from leap.mail.generator import Generator from leap.mail.utils import json_loads, empty @@ -340,9 +339,7 @@ class IncomingMail(Service): "1" if success else "0") return self._process_decrypted_doc(doc, decrdata) - d = self._keymanager.decrypt( - doc.content[ENC_JSON_KEY], - self._userid, OpenPGPKey) + d = self._keymanager.decrypt(doc.content[ENC_JSON_KEY], self._userid) d.addErrback(self._errback) d.addCallback(process_decrypted) d.addCallback(lambda data: (doc, data)) @@ -525,8 +522,7 @@ class IncomingMail(Service): return (msg, signkey) d = self._keymanager.decrypt( - encdata, self._userid, OpenPGPKey, - verify=senderAddress) + encdata, self._userid, verify=senderAddress) d.addCallbacks(build_msg, self._decryption_error, errbackArgs=(msg,)) return d @@ -569,8 +565,7 @@ class IncomingMail(Service): end = data.find(PGP_END) pgp_message = data[begin:end + len(PGP_END)] d = self._keymanager.decrypt( - pgp_message, self._userid, OpenPGPKey, - verify=senderAddress) + pgp_message, self._userid, verify=senderAddress) d.addCallbacks(decrypted_data, self._decryption_error, errbackArgs=(data,)) else: @@ -595,8 +590,7 @@ class IncomingMail(Service): msg = copy.deepcopy(origmsg) data = self._serialize_msg(msg.get_payload(0)) detached_sig = self._extract_signature(msg) - d = self._keymanager.verify(data, sender_address, OpenPGPKey, - detached_sig) + d = self._keymanager.verify(data, sender_address, detached_sig) d.addCallback(lambda sign_key: (msg, sign_key)) d.addErrback(lambda _: (msg, keymanager_errors.InvalidSignature())) @@ -708,7 +702,7 @@ class IncomingMail(Service): else: return failure - d = self._keymanager.fetch_key(address, url, OpenPGPKey) + d = self._keymanager.fetch_key(address, url) d.addCallback( lambda _: logger.info("Imported key from header %s" % (url,))) @@ -749,9 +743,7 @@ class IncomingMail(Service): for attachment in attachments: if MIME_KEY == attachment.get_content_type(): d = self._keymanager.put_raw_key( - attachment.get_payload(decode=True), - OpenPGPKey, - address=address) + attachment.get_payload(decode=True), address=address) d.addCallbacks(log_key_added, failed_put_key) deferreds.append(d) d = defer.gatherResults(deferreds) diff --git a/src/leap/mail/incoming/tests/test_incoming_mail.py b/src/leap/mail/incoming/tests/test_incoming_mail.py index e4e8dbf..c5828b7 100644 --- a/src/leap/mail/incoming/tests/test_incoming_mail.py +++ b/src/leap/mail/incoming/tests/test_incoming_mail.py @@ -31,7 +31,6 @@ from mock import Mock from twisted.internet import defer from leap.keymanager.errors import KeyAddressMismatch -from leap.keymanager.openpgp import OpenPGPKey from leap.mail.adaptors import soledad_indexes as fields from leap.mail.constants import INBOX_NAME from leap.mail.imap.account import IMAPAccount @@ -122,7 +121,7 @@ subject: independence of cyberspace def fetch_key_called(ret): self.fetcher._keymanager.fetch_key.assert_called_once_with( - ADDRESS_2, KEYURL, OpenPGPKey) + ADDRESS_2, KEYURL) d = self._create_incoming_email(message.as_string()) d.addCallback( @@ -167,7 +166,7 @@ subject: independence of cyberspace def put_raw_key_called(_): self.fetcher._keymanager.put_raw_key.assert_called_once_with( - KEY, OpenPGPKey, address=ADDRESS_2) + KEY, address=ADDRESS_2) d = self._do_fetch(message.as_string()) d.addCallback(put_raw_key_called) @@ -186,7 +185,7 @@ subject: independence of cyberspace def put_raw_key_called(_): self.fetcher._keymanager.put_raw_key.assert_called_once_with( - KEY, OpenPGPKey, address=ADDRESS_2) + KEY, address=ADDRESS_2) d = self._do_fetch(message.as_string()) d.addCallback(put_raw_key_called) @@ -210,7 +209,7 @@ subject: independence of cyberspace def put_raw_key_called(_): self.fetcher._keymanager.put_raw_key.assert_called_once_with( - KEY, OpenPGPKey, address=ADDRESS_2) + KEY, address=ADDRESS_2) self.assertFalse(self.fetcher._keymanager.fetch_key.called) d = self._do_fetch(message.as_string()) @@ -235,9 +234,9 @@ subject: independence of cyberspace def put_raw_key_called(_): self.fetcher._keymanager.put_raw_key.assert_called_once_with( - KEY, OpenPGPKey, address=ADDRESS_2) + KEY, address=ADDRESS_2) self.fetcher._keymanager.fetch_key.assert_called_once_with( - ADDRESS_2, KEYURL, OpenPGPKey) + ADDRESS_2, KEYURL) d = self._do_fetch(message.as_string()) d.addCallback(put_raw_key_called) @@ -286,9 +285,7 @@ subject: independence of cyberspace self.assertTrue(self.fetcher._add_decrypted_header.called, "There was some errors with decryption") - d = self._km.encrypt( - self.EMAIL, - ADDRESS, OpenPGPKey, sign=ADDRESS_2) + d = self._km.encrypt(self.EMAIL, ADDRESS, sign=ADDRESS_2) d.addCallback(create_encrypted_message) d.addCallback( lambda message: @@ -333,7 +330,7 @@ subject: independence of cyberspace ENC_JSON_KEY: encr_data } return email - d = self._km.encrypt(data, ADDRESS, OpenPGPKey, fetch_remote=False) + d = self._km.encrypt(data, ADDRESS, fetch_remote=False) d.addCallback(set_email_content) return d |