diff options
author | varac <varacanero@zeromail.org> | 2017-02-02 11:54:28 +0100 |
---|---|---|
committer | varac <varacanero@zeromail.org> | 2017-02-02 11:56:32 +0100 |
commit | 3a414d801a728516c68e1f3ff18c6c51286fd674 (patch) | |
tree | 49157a0b82af34aa3715b1d33e24b4051760deb4 /src/leap/mx/mail_receiver.py | |
parent | 08ecab8e481086f46e300795d88779454b83883d (diff) | |
parent | 28936b276cc2fa8f3572c9248ed4bc5bef4ea7c4 (diff) |
Merge branch 'master' into debian/platform-0.10
Diffstat (limited to 'src/leap/mx/mail_receiver.py')
-rw-r--r-- | src/leap/mx/mail_receiver.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/leap/mx/mail_receiver.py b/src/leap/mx/mail_receiver.py index 7c5a368..b200772 100644 --- a/src/leap/mx/mail_receiver.py +++ b/src/leap/mx/mail_receiver.py @@ -202,14 +202,22 @@ class MailReceiver(Service): with openpgp.TempGPGWrapper(gpgbinary='/usr/bin/gpg') as gpg: gpg.import_keys(pubkey) key = gpg.list_keys().pop() + + encryption_result = gpg.encrypt( + json.dumps(data, ensure_ascii=False), + key["fingerprint"], + symmetric=False) + + if not encryption_result.ok: + log.msg("_encrypt_message: Encryption failed with status: %r" + % (encryption_result.status,)) + return None + doc.content = { self.INCOMING_KEY: True, self.ERROR_DECRYPTING_KEY: False, ENC_SCHEME_KEY: EncryptionSchemes.PUBKEY, - ENC_JSON_KEY: str(gpg.encrypt( - json.dumps(data, ensure_ascii=False), - key["fingerprint"], - symmetric=False)) + ENC_JSON_KEY: str(encryption_result) } return doc |