diff options
author | Tomás Touceda <chiiph@leap.se> | 2014-01-17 15:53:03 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2014-01-17 15:53:03 -0300 |
commit | 4ada92f8b062d77925e5f57c65e9d8ae1878934d (patch) | |
tree | e4632c84e1816d307a75d65695027cb7a6c4da6d | |
parent | 2631d418233e31dd9dfd4d97734372cb67d09951 (diff) | |
parent | f1f9debfca03b3da1bc8c4dc4fb4eb129ab603a1 (diff) |
Merge remote-tracking branch 'refs/remotes/ivan/bug/do-not-decode-decrypted-data' into develop
-rw-r--r-- | changes/do-not-decode-decrypted-data | 1 | ||||
-rw-r--r-- | src/leap/keymanager/openpgp.py | 14 |
2 files changed, 3 insertions, 12 deletions
diff --git a/changes/do-not-decode-decrypted-data b/changes/do-not-decode-decrypted-data new file mode 100644 index 00000000..a708be6e --- /dev/null +++ b/changes/do-not-decode-decrypted-data @@ -0,0 +1 @@ + o Do not decode decrypted data, return as str. diff --git a/src/leap/keymanager/openpgp.py b/src/leap/keymanager/openpgp.py index 4276b19f..950d022c 100644 --- a/src/leap/keymanager/openpgp.py +++ b/src/leap/keymanager/openpgp.py @@ -17,12 +17,10 @@ """ Infrastructure for using OpenPGP keys in Key Manager. """ -import locale import logging import os import re import shutil -import sys import tempfile from contextlib import closing @@ -522,7 +520,7 @@ class OpenPGPScheme(EncryptionScheme): return result.data except errors.GPGError as e: logger.error('Failed to decrypt: %s.' % str(e)) - raise error.EncryptError() + raise errors.EncryptError() def decrypt(self, data, privkey, passphrase=None, verify=None): """ @@ -564,15 +562,7 @@ class OpenPGPScheme(EncryptionScheme): 'Failed to verify signature with key %s: %s' % (verify.key_id, result.stderr)) - # XXX: this is the encoding used by gpg module - # https://github.com/isislovecruft/python-gnupg/\ - # blob/master/gnupg/_meta.py#L121 - encoding = locale.getpreferredencoding() - if encoding is None: - encoding = sys.stdin.encoding - if encoding is None: - encoding = 'utf-8' - return result.data.decode(encoding, 'replace') + return result.data except errors.GPGError as e: logger.error('Failed to decrypt: %s.' % str(e)) raise errors.DecryptError(str(e)) |