Do not decode decrypted data, return as str.
authorIvan Alejandro <ivanalejandro0@gmail.com>
Fri, 17 Jan 2014 17:53:10 +0000 (14:53 -0300)
committerIvan Alejandro <ivanalejandro0@gmail.com>
Fri, 17 Jan 2014 17:53:10 +0000 (14:53 -0300)
changes/do-not-decode-decrypted-data [new file with mode: 0644]
src/leap/keymanager/openpgp.py

diff --git a/changes/do-not-decode-decrypted-data b/changes/do-not-decode-decrypted-data
new file mode 100644 (file)
index 0000000..a708be6
--- /dev/null
@@ -0,0 +1 @@
+  o Do not decode decrypted data, return as str.
index 4276b19..961e1ed 100644 (file)
@@ -564,15 +564,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))