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