diff options
author | Tomas Touceda <chiiph@leap.se> | 2013-04-25 15:25:07 -0300 |
---|---|---|
committer | Tomas Touceda <chiiph@leap.se> | 2013-05-07 14:02:12 -0300 |
commit | f6d6ff0862052605a5a3af328daadc0b8ce9e3bb (patch) | |
tree | 0cc312ce05aeb139925c82681719c1ef75d8c11e /src/leap | |
parent | 4ed3e03aa4012905d04d62c1d34e3440f8e0dacc (diff) |
Save unencrypted if no pubkey
Diffstat (limited to 'src/leap')
-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) |