How to verify a signature using M2Crypto 0.16
Posted
by Daniel Mccain
on Stack Overflow
See other posts from Stack Overflow
or by Daniel Mccain
Published on 2010-05-17T11:21:17Z
Indexed on
2010/05/20
4:00 UTC
Read the original article
Hit count: 300
After some goggling I found some usual answers for this question, like:
http://stackoverflow.com/questions/595114/how-to-load-an-rsa-key-from-a-pem-file-and-use-it-in-python-crypto
some code:
x509 = X509.load_cert_string(certificate)
pubkey = x509.get_pubkey()
pubkey.reset_context(md=sha1)
pubkey.verify_init()
pubkey.verify_update(content)
decoded_signature = signature.decode('base64')
if pubkey.verify_final(decoded_signature)==0:
print 'error'
sys.exit(1)
and the code presented above works fine in M2Crypto 0.20. But I need to do exactly the same think using the M2Crypto 0.16 (the official package in RHEL5), and I have problems using the pubkey.verify_final method because in this particular version the signature parameter doesn't exist. So how can I do it? using the M2Crypto 0.16 Thanks.
© Stack Overflow or respective owner