[pycrypto] providing signature in base64

Cornelius Kölbel cornelius.koelbel at lsexperts.de
Wed May 9 10:28:30 EDT 2012


Hello,

I have a signature provided in base64 like this:

XQgVBkxrmJXqN2+xkJx8dGRecadoLi61vjBTsl+kYibji0pf6ZsxYF2ewniV7pIbtjQxxIridBRtLo9d1Rpq6QvjvuVbVzqqimQeFZnQTp9scSfAbKCtDe1F4lEWCLP6s/6op3jgPpmgd0p5kPaA4iWLM5IjleT7kxgniggBXIky1aMq4L8DtLujcfHNLeJyXpw9TDPg/2KEYZGT1WqiXIeIuYPt7UySOVnmgIoQYstu7C5Vsy5hjzBfhpVvKaPjXEDeETL4UoO2S9H+hu0x932HyyiNTYCpY9VFQnptsVtTkkOvEqhY3xxYix4nzeU+vXc4hFFnhAZMJbPYmuPy5w==

but I am breaking my head how to pass this to the verify function.

I create the RSA Object from a PEM encoded public key. This works fine.

But when I try to unpack the base64 encoded signature, I do not get ONE
long but a tuple with 32 long int.

    long_signature= struct.unpack('Q'*32, sign.decode("base64"))
    hash = sha256(licStr).digest()
    RSAKey = RSA.importKey(public)
    ret =  RSAKey.verify(hash, long_signature)

I know that this is more a matter of how to handle the unpack function,
but did not find anything about this.

Thanks a lot and kind regards
Cornelius

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.dlitz.net/pipermail/pycrypto/attachments/20120509/cc4a977a/attachment.pgp>


More information about the pycrypto mailing list