[Pyme-help] Re: PyME: Segmentation Faults
Status: Beta
Brought to you by:
belyi
From: Igor B. <be...@us...> - 2005-04-20 20:16:30
|
Stefan, I've tried to use your functions and they seem to work perfectly: signature = sign("fr...@mi...", "Hello") print verify("Hello", signature) yields (if "print result.signatures.fpr" is uncommented): 024E0908E5E7CD865B7D87BDCAB3D9DD2A51DAAC valid, but more Information There's a chance that Frodo cannot sign - what value is shown for key.can_sign? Another problem can be related to how PyMe is compiled - do you use precompiled package or compiled pyme yourself? If you compiled it yourself - what version of PyMe, GPGME, and Swing did you use? Any warning? If you use precompiled version - what version of PyMe and GnuPG do you use? Cheers, Igor P.S. I've Cc: this message to the newly created pyme-help mailing list. You will need to subscribe to it before you can post messages there. You can subscribe at the following location: https://lists.sourceforge.net/lists/listinfo/pyme-help Stefan Neumann wrote: >Hi Igor. >So, with some help, I finally finished the signing and verifying. But >there are still some errors: > >First of all, I can't get any information about the summary. > > text = c.op_verify(sig,signed_text,None) > result = c.op_verify_result() > summary = result.signatures.summary > >In the beginning, the value was always 4 (sigsum.RED). Since I fixed the >bugs, I only get a zero (The same with result.signatures.status) > >That is the first thing, the other is the problem of segmentation faults: > >I have them with: > >result.signatures.next >result.signatures.exp_timestamp >result.signatures.validity_reason >result.signatures.validity > >So, I will give you my functions: > >================= > >def sign(sender,msg,clear=False): > > if(clear): > _mode=mode.CLEAR > else: > _mode=mode.DETACH > > message = core.Data(msg) > sig = core.Data() > ctx = core.Context() > ctx.set_armor(1) > > ctx.op_keylist_start(sender, 0) > key=ctx.op_keylist_next() > > ctx.signers_clear() > ctx.signers_add(key) > > ctx.set_passphrase_cb(getpassphrase,"") > ctx.op_sign(message,sig,mode.DETACH) > sig.seek(0,0) > return sig.read() > >================= > >def verify(message,sig): > > signed_text=core.Data(message) > sig = core.Data(sig) > c=core.Context() > > text = c.op_verify(sig,signed_text,None) > result = c.op_verify_result() ># return result > summary = result.signatures.summary ># print summary > msg="" > > if (summary&sigsum.VALID|summary==0): > msg="Totally valid" > else: > if (summary&sigsum.GREEN): > msg += "valid, but more Information" > if (summary&sigsum.RED): > msg+="not valid" > if (summary&sigsum.KEY_REVOKED): > msg+="The key or at least one certificate has been revoked." > if (summary&sigsum.KEY_EXPIRED): > msg+="The key or one of the certificates has expired." > if (summary&sigsum.SIG_EXPIRED): > msg+="The signature has expired." > if (summary&sigsum.KEY_MISSING): > msg+="Can\'t verify due to a missing key or certificate." > if (summary&sigsum.CRL_MISSING): > msg+=" The CRL (or an equivalent mechanism) is not available." > if (summary&sigsum.CRL_TOO_OLD): > msg+="Available CRL is too old." > if (summary&sigsum.BAD_POLICY): > msg+="A policy requirement was not met." > if (summary&sigsum.SYS_ERROR): > msg+="A system error occured." > status = result.signatures.status ># print status ># print result.signatures.fpr > return msg > >===================== > >So, if you want to check the result, just uncomment the return result >line. In my checking of summary, i use summary==0 just in case, that it >is totally valid, but i am not sure about it. > >Best regards, >Stefan > > > |