File 0002-passphrase_cb-is-deprecated.patch of Package python-gpgme (Revision 302ff94c6880da3398121c96e75c7e18)
Currently displaying revision 302ff94c6880da3398121c96e75c7e18 , Show latest
xxxxxxxxxx
1
From 6648b075fb3d434c599d7e1793bd1f0bbe85dfe3 Mon Sep 17 00:00:00 2001
2
From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3
Date: Mon, 1 Feb 2016 19:25:12 -0500
4
Subject: [PATCH 2/6] passphrase_cb is deprecated
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
tests/util.py | 8 +++++++-
20
1 file changed, 7 insertions(+), 1 deletion(-)
21
22
diff --git a/tests/util.py b/tests/util.py
23
index cd803c2..86892ca 100644
24
--- a/tests/util.py
25
+++ b/tests/util.py
26
27
28
class GpgHomeTestCase(unittest.TestCase):
29
30
- gpg_conf_contents = ''
31
+ gpg_conf_contents = 'pinentry-mode loopback'
32
+ gpg_agent_conf_contents = 'allow-loopback-pinentry'
33
+
34
import_keys = []
35
36
def keyfile(self, key):
37
38
fp.write(self.gpg_conf_contents.encode('UTF-8'))
39
fp.close()
40
41
+ fp = open(os.path.join(self._gpghome, 'gpg-agent.conf'), 'wb')
42
+ fp.write(self.gpg_agent_conf_contents.encode('UTF-8'))
43
+ fp.close()
44
+
45
# import requested keys into the keyring
46
ctx = gpgme.Context()
47
for key in self.import_keys:
48
--
49
2.7.4
50
51