Re: [Pyme-help] help needed with verify and 0.5.0
Status: Beta
Brought to you by:
belyi
From: Carsten R. <car...@ga...> - 2008-11-24 08:22:39
|
Hello Igor and Bernhard, thank you for your help. In the meantime I tried another approach (the one Bernhard suggested) to try to enable the latest version of pyme on the target system (I was not desperate enough before to do so ;-) ). I had to compile libgpg-errors, libgpgme, swig and after some changes in Make- and header-files (python was at a very unusual place on that system) installing pyme worked and I can use the software I have written for that version of pyme. So thanks again for all your help. With best regards Carsten Reimer > Igor Belyi wrote: >> Carsten Reimer wrote: >>> sory for asking for help for this _very outdated_ version of pyme, >>> but the system that has to be used does not allow any other version >>> because of the underlying gpgme-lib. >>> >>> I managed to en- and decrypt messages and sign as well but verifying >>> does not work for me. >>> >>> The problem is in the third parameter of op_verify which in the >>> original gpgme-func is of type GpgmeSigStat and will take the >>> summarized result of the verification (with 0.8.0 you can do that >>> with op_verify_result() and then check the signatures yourself). >>> As far as I can see there is no equivalent to this GpgmeSigStat-type >>> in pyme so I tried to set it to None or use an integer var but the >>> latter resulted in a type error requesting a _p_GpgmeSigStat type for >>> that variable while the first resulted in an error messoge 'Invalid >>> value (3)'. >>> >>> I tried as well using only op_verify_start and asking >>> get_sig_ulong_attr(0, attr.SIG_SUMMARY, 0) afterwards but that does >>> not lead to anything else but zero as return value. >>> >>> So is 0.5.0 not able to verify signatures or am I too blind to see >>> how that works? >>> >> I don't remember details of the libgpgme6 API. Could you send gpgme.h >> from the version of the gpgme-lib on your >> system? At least, declaration of the op_verify method and of the >> structures used there as parameters. > OK, the oldest gpgme-lib I could find is 0.3.13 although the pyme-0.5.0 > from the John Goerzen's site was built against > 0.3.12 but I don't think the difference should be important for your > problem. > > As for the op_verify problem I think you are out of luck unless you can > recompile pyme on that system. > > Passing by reference in Python wrapper requires helper functions. If you > look at the gpgme.i file their generation > is requested with %pointer_functions() directive for each type passed by > reference in some gpgme function. You'll > need to add the following directive in there: > %pointer_functions(GpgmeSigStat, GpgmeSigStat_p); > > After that you should add the following method to the Context class in > pyme/core.py: > def op_verify(self, sig, text): > ptr = gpgme.new_GpgmeSigStat_p() > errorcheck(gpgme.gpgme_op_verify(self.wrapped, sig, text, ptr)) > status = gpgme.GpgmeSigStat_p_value(ptr) > gpgme.delete_GpgmeSigStat_p(ptr) > return status > > With these changes after recompile op_verify will require only 2 > parameters and will return status value. > > Hope it's helpful. > Cheers, > Igor > -- Carsten Reimer Web Developer car...@ga... Phone +49.228.42150.73 Galileo Press GmbH Rheinwerkallee 4 - 53227 Bonn - Germany Phone +49.228.42150.0 (Zentrale) .77 (Fax) http://www.galileo-press.de/ Managing Directors: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker HRB 8363 Amtsgericht Bonn |