diff options
author | Tomas Touceda <chiiph@leap.se> | 2013-04-25 15:25:07 -0300 |
---|---|---|
committer | Tomas Touceda <chiiph@leap.se> | 2013-04-25 15:25:07 -0300 |
commit | facf49f24fa54a67ec52846e9e0f49bf0b50bc41 (patch) | |
tree | 111f0f89fcd2cffec691f9c53ff79e50381ed577 /src | |
parent | 7837a2227fef6f443114cb9f6d3521bab31495d2 (diff) |
Save unencrypted if no pubkey
Diffstat (limited to 'src')
-rw-r--r-- | src/leap/mx/mail_receiver.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/leap/mx/mail_receiver.py b/src/leap/mx/mail_receiver.py index 9006471..20b5f4a 100644 --- a/src/leap/mx/mail_receiver.py +++ b/src/leap/mx/mail_receiver.py @@ -50,13 +50,15 @@ def _encrypt_message(uuid_pubkey, address_message): logger.debug("Encrypting message to %s's pubkey" % (uuid,)) logger.debug("Pubkey: %s" % (pubkey,)) - if pubkey is None or len(pubkey) == 0: - logger.exception("No public key found") - raise Exception("No public key found") - doc = LeapDocument(encryption_scheme=EncryptionSchemes.PUBKEY, doc_id=str(pyuuid.uuid4())) + if pubkey is None or len(pubkey) == 0: + doc.content = { + "_unencrypted_json": message + } + return uuid, doc + def _ascii_to_openpgp_cb(gpg): key = gpg.list_keys().pop() return openpgp._build_key_from_gpg(address, key, pubkey) |