[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [bridgedb/master] Fix GPGME 'invalid argument' error while signing.
commit fafbdc77a2656185740790e688ced745518c72c7
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date: Wed Apr 23 01:38:31 2014 +0000
Fix GPGME 'invalid argument' error while signing.
* FIX error introduced in commit b2c7a2a2 in branch for #11522
fixes. The in-memory files for the message and the signature file for
libgpgme need to be type io.BytesIO(buffer(message)), not
io.StringIO(unicode()) like the rest of the email body files.
---
lib/bridgedb/crypto.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/lib/bridgedb/crypto.py b/lib/bridgedb/crypto.py
index b70069d..4ce30b2 100644
--- a/lib/bridgedb/crypto.py
+++ b/lib/bridgedb/crypto.py
@@ -343,8 +343,7 @@ def getGPGContext(cfg):
ctx.signers = (bridgedbKey,)
logging.debug("Testing signature created with GnuPG key...")
- testMessage = "Testing 1 2 3"
- signatureText, sigs = gpgSignMessage(ctx, testMessage)
+ signatureText, sigs = gpgSignMessage(ctx, "Testing 1 2 3")
if not len(sigs) == 1:
raise PythonicGpgmeError("Testing couldn't produce a signature "\
@@ -396,8 +395,8 @@ def gpgSignMessage(gpgmeCtx, messageString, mode=None):
if not mode:
mode = gpgme.SIG_MODE_CLEAR
- msgFile = io.StringIO(unicode(messageString))
- sigFile = io.StringIO()
+ msgFile = io.BytesIO(buffer(messageString))
+ sigFile = io.BytesIO()
sigList = gpgmeCtx.sign(msgFile, sigFile, mode)
sigFile.seek(0)
signature = sigFile.read()
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits