diff options
author | Kali Kaneko <kali@leap.se> | 2013-08-02 11:40:05 +0200 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2013-08-02 11:40:05 +0200 |
commit | 30b1f13e23d7b56a1169dedc594a2be039d9e14c (patch) | |
tree | 6b368ce236bffad50eb60b3737d8f37d8a384068 /src/leap/mx | |
parent | b69c5b7892a08c03735606aabdf9a51590295c58 (diff) | |
parent | 803f23e45740c702ebc66f9741c0af564b54f3b8 (diff) |
Merge remote-tracking branch 'chiiph/bug/import_asciiarmored' into develop
Diffstat (limited to 'src/leap/mx')
-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 b4e0d18..43925df 100644 --- a/src/leap/mx/mail_receiver.py +++ b/src/leap/mx/mail_receiver.py @@ -116,18 +116,20 @@ class MailReceiver(Service): if pubkey is None or len(pubkey) == 0: doc.content = { + "incoming": True, "_enc_scheme": EncryptionSchemes.NONE, "_enc_json": json.dumps(data) } return uuid, doc - def _ascii_to_openpgp_cb(gpg): + openpgp_key = None + with openpgp.temporary_gpgwrapper() as gpg: + gpg.import_keys(pubkey) key = gpg.list_keys().pop() - return openpgp._build_key_from_gpg(address, key, pubkey) - - openpgp_key = openpgp._safe_call(_ascii_to_openpgp_cb, pubkey) + openpgp_key = openpgp._build_key_from_gpg(address, key, pubkey) doc.content = { + "incoming": True, "_enc_scheme": EncryptionSchemes.PUBKEY, "_enc_json": openpgp.encrypt_asym(json.dumps(data), openpgp_key) |