summaryrefslogtreecommitdiff
path: root/src/leap/common/keymanager
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2013-04-29 16:07:30 -0300
committerdrebs <drebs@leap.se>2013-04-29 16:07:30 -0300
commit852a0fa34a94b588f66e2af0aa628d058c243fd3 (patch)
treeb238142f0b916b575873fcbc524838a94db9f990 /src/leap/common/keymanager
parent4e309e8be7dad025b7e30e99e10dbc5fb49f9bf5 (diff)
Remove string conversion for encryption/decryption results.
Diffstat (limited to 'src/leap/common/keymanager')
-rw-r--r--src/leap/common/keymanager/openpgp.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/leap/common/keymanager/openpgp.py b/src/leap/common/keymanager/openpgp.py
index fa3f732..94d55cc 100644
--- a/src/leap/common/keymanager/openpgp.py
+++ b/src/leap/common/keymanager/openpgp.py
@@ -58,9 +58,8 @@ def encrypt_sym(data, passphrase):
"""
def _encrypt_cb(gpg):
- return str(
- gpg.encrypt(
- data, None, passphrase=passphrase, symmetric=True))
+ return gpg.encrypt(
+ data, None, passphrase=passphrase, symmetric=True).data
return _safe_call(_encrypt_cb)
@@ -79,7 +78,7 @@ def decrypt_sym(data, passphrase):
"""
def _decrypt_cb(gpg):
- return str(gpg.decrypt(data, passphrase=passphrase))
+ return gpg.decrypt(data, passphrase=passphrase).data
return _safe_call(_decrypt_cb)
@@ -99,9 +98,8 @@ def encrypt_asym(data, key):
leap_assert(key.private is False, 'Key is not public.')
def _encrypt_cb(gpg):
- return str(
- gpg.encrypt(
- data, key.fingerprint, symmetric=False))
+ return gpg.encrypt(
+ data, key.fingerprint, symmetric=False).data
return _safe_call(_encrypt_cb, key.key_data)
@@ -121,7 +119,7 @@ def decrypt_asym(data, key):
leap_assert(key.private is True, 'Key is not private.')
def _decrypt_cb(gpg):
- return str(gpg.decrypt(data))
+ return gpg.decrypt(data).data
return _safe_call(_decrypt_cb, key.key_data)