summaryrefslogtreecommitdiff
path: root/keymanager/src/leap
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2014-07-25 19:26:19 -0500
committerRuben Pollan <meskio@sindominio.net>2014-07-25 19:26:19 -0500
commit93bd48dd8855e4b4c7ebccb0148fd09c4a347f65 (patch)
tree45b70d51e17389c52f19266f8dddc760af201e1b /keymanager/src/leap
parent485953a1eb822eaac66bbe07ce5bde592c07a5e4 (diff)
gpg.verify_file() gets the data as a filename not as a binary stream
Diffstat (limited to 'keymanager/src/leap')
-rw-r--r--keymanager/src/leap/keymanager/openpgp.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/keymanager/src/leap/keymanager/openpgp.py b/keymanager/src/leap/keymanager/openpgp.py
index 950d022c..46ae2aab 100644
--- a/keymanager/src/leap/keymanager/openpgp.py
+++ b/keymanager/src/leap/keymanager/openpgp.py
@@ -649,13 +649,17 @@ class OpenPGPScheme(EncryptionScheme):
result = gpg.verify(data)
else:
# to verify using a detached sig we have to use
- # gpg.verify_file(), which receives the data as a binary
- # stream and the name of a file containing the signature.
+ # gpg.verify_file(), which receives the name of
+ # files containing the date and the signature.
sf, sfname = tempfile.mkstemp()
with os.fdopen(sf, 'w') as sfd:
sfd.write(detached_sig)
- with closing(_make_binary_stream(data, gpg._encoding)) as df:
- result = gpg.verify_file(df, sig_file=sfname)
+ df, dfname = tempfile.mkstemp()
+ with os.fdopen(df, 'w') as sdd:
+ sdd.write(data)
+ result = gpg.verify_file(dfname, sig_file=sfname)
+ os.unlink(sfname)
+ os.unlink(dfname)
gpgpubkey = gpg.list_keys().pop()
valid = result.valid
rfprint = result.fingerprint