Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1 | From ba0dc8273e4f83bcd2d43baa5910aae34b93048c Mon Sep 17 00:00:00 2001 |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 2 | From: Daniel Kahn Gillmor <dkg@fifthhorseman.net> |
| 3 | Date: Mon, 1 Feb 2016 19:25:12 -0500 |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 4 | Subject: [PATCH] passphrase_cb is deprecated |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 5 | |
| 6 | https://bugs.gnupg.org/gnupg/issue767 indicates that |
| 7 | gpgme_set_passphrase_cb is a deprecated corner of the API and that |
| 8 | developers using gpgme should really rely on the gpg-agent to handle |
| 9 | this stuff. This should actually simplify things for most |
| 10 | installations -- just strip out all passphrase handling from your |
| 11 | application entirely, relying on gpg to figure out how to find the |
| 12 | agent, and relying on the agent figuring out how to prompt the user |
| 13 | (if necessary). |
| 14 | |
| 15 | However, if a developer really wants to use the passphrase callback |
| 16 | approach, they'll have to use loopback pinentry. This sets up the |
| 17 | test suite to be able to make those tests. |
| 18 | |
| 19 | Upstream-Status: Backport |
| 20 | |
| 21 | Signed-off-by: Catalin Enache <catalin.enache@windriver.com> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 22 | |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 23 | --- |
| 24 | tests/util.py | 8 +++++++- |
| 25 | 1 file changed, 7 insertions(+), 1 deletion(-) |
| 26 | |
| 27 | diff --git a/tests/util.py b/tests/util.py |
| 28 | index cd803c2..86892ca 100644 |
| 29 | --- a/tests/util.py |
| 30 | +++ b/tests/util.py |
| 31 | @@ -28,7 +28,9 @@ keydir = os.path.join(os.path.dirname(__file__), 'keys') |
| 32 | |
| 33 | class GpgHomeTestCase(unittest.TestCase): |
| 34 | |
| 35 | - gpg_conf_contents = '' |
| 36 | + gpg_conf_contents = 'pinentry-mode loopback' |
| 37 | + gpg_agent_conf_contents = 'allow-loopback-pinentry' |
| 38 | + |
| 39 | import_keys = [] |
| 40 | |
| 41 | def keyfile(self, key): |
| 42 | @@ -41,6 +43,10 @@ class GpgHomeTestCase(unittest.TestCase): |
| 43 | fp.write(self.gpg_conf_contents.encode('UTF-8')) |
| 44 | fp.close() |
| 45 | |
| 46 | + fp = open(os.path.join(self._gpghome, 'gpg-agent.conf'), 'wb') |
| 47 | + fp.write(self.gpg_agent_conf_contents.encode('UTF-8')) |
| 48 | + fp.close() |
| 49 | + |
| 50 | # import requested keys into the keyring |
| 51 | ctx = gpgme.Context() |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 52 | for key in self.import_keys: |