Commit Graph

25 Commits

Author SHA1 Message Date
André Apitzsch 125ce523e4 Rename src directory 2017-07-02 17:25:47 +02:00
Philipp Hörist 1bf66b857a Always pass utf8 encoded strings to python-gnupg
self.encoding which we set in the init is only intended
to decode gpg´s stderr which uses a system specific encoding.

if we dont encode the data we pass to python-gnupg ourself, it will fallback and use self.encoding.
This might be of no concern if self.encoding is set to 'utf8' and when we are on Linux
which has a preferred encoding of 'utf8'.

But if we are on Windows the preferred encoding for stderr
is most of the time not 'utf8'. If python-gnupg tries to decode a stderr stream that is for example
encoded with 'cp1252' with our set encoding of 'utf8' this will fail.

The solution is to pre-encode the data before we pass it to python-gnupg, so it does not have to
use self.encoding as a fallback. And set self.encoding='latin1' because latin1 will not yield exceptions
on decoding errors. Also gpg itself will fallback to latin1 as stderr encoding when it cant determine the
preferred encoding of a system.

self.decode_errors is used for something differently, and has no influence on the situation.

Fixes #8644
2017-06-08 19:33:01 +02:00
Philipp Hörist 2872993b0c Remove unused GPG code 2017-06-08 19:10:04 +02:00
Philipp Hörist 92b0a15521 Pass use_agent to GPG init instead of overwrite 2017-06-08 19:09:22 +02:00
Philipp Hörist 78b562f7a5 Make PGP encoding configurable
python-gnupg uses latin1 as default encoding because GPG itself uses
latin1 as default.
We should not override this default with getpreferredencoding, because
getpreferredencoding maybe returns something else than what GPG is configured
on that system.

Example: On Windows
GPG is run in default mode with 'latin1'
getpreferredencoding returns 'cp1252'

The approach would be now to default to latin1 as it is GPGs default.
And if the User sets a different ecoding for GPG he has to set it in
Gajim aswell.
2017-04-12 22:50:02 +02:00
Yann Leboulanger 458d1083bc do not list all keys when we want to know if we have a key. Fixes #8477 2016-12-17 14:06:36 +01:00
Yann Leboulanger d9efb31b2e don't crash when gnupg doesn't have a status attribute. 2016-12-17 13:32:35 +01:00
Yann Leboulanger 995a154c59 Remove gnupg from our sources and optionnaly depend on it. Fixes #8475 2016-12-10 17:32:04 +01:00
Yann Leboulanger 206746cbfb make GPG work with gpg2 binary if present. Fixes #8268 2016-02-21 18:54:31 +01:00
Yann Leboulanger d318481176 Correctly check and handle the case when we don't trust our own key. Fixes #8122 2015-11-01 16:30:27 +01:00
Yann Leboulanger 190b1b7886 fix calling gnupg.list_keys. Fixes #8122 2015-08-12 22:13:29 +02:00
Yann Leboulanger 9c6752f150 correctly detect that key is not trusted before encrypting. Doc says: "gpg just prints a message to the console, but does not provide a specific error indication that the Python wrapper can use." Fixes #8040. See #8041 2015-07-29 22:32:02 +02:00
Yann Leboulanger a17ff4b45e fix GPG encoding issues. Fixes #7988 2015-03-17 22:06:36 +01:00
Denis Fomin 4b33634a0b Copyright 2013>2014 2014-01-02 12:33:54 +04:00
Yann Leboulanger 1b0406a814 fix the "do not ask me again" behaviour with untrusted GPG key warning. Fixes #7584 2013-12-01 10:06:38 +01:00
Yann Leboulanger fbf8fd7ca0 [fedor] fix gpg signature when hash algo is not SHA-1. Fixes #7569 2013-11-30 10:10:39 +01:00
Yann Leboulanger 874e79d820 don't crash when GPG key are badly encrypted 2013-07-17 12:50:34 +02:00
Yann Leboulanger 3f15047919 fix using GPG with non-utf8 OS. Fixes #7227 2013-06-20 20:48:34 +02:00
Yann Leboulanger 9c8c1de03f update my copyright 2013-04-05 21:35:39 +02:00
Yann Leboulanger 912f0e921d fix imports and many py3 changements 2013-01-02 13:54:02 +01:00
Yann Leboulanger 069bddbbcb remove call to unicode() 2013-01-01 21:06:16 +01:00
Yann Leboulanger b050e63b60 don't crash when there are non-ascii chars in gpg keys list 2012-05-30 08:30:49 +02:00
Yann Leboulanger c28282300b update python-gnupg to 0.3.0 + add KEYEXPIRED support. Fixes #7151 2012-05-18 16:58:51 +02:00
Yann Leboulanger 3a3f99d618 upgrade copyright 2012-01-11 22:20:34 +01:00
Yann Leboulanger 49a797dd54 rename GnuPG.py to gpg.py. Fixes #6055 2010-11-30 11:41:14 +01:00
Renamed from src/common/GnuPG.py (Browse further)