Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rom Crypto import PublicKey
- from Crypto.Hash import MD5
- from Crypto.Util import number
- with open('public.pem') as f:
- pubKey = f.read()
- with open('private.pem') as f:
- prvKeyData = f.read()
- with open('data.txt') as f:
- data = f.read()
- with open('signature') as f:
- signature = f.read()
- hash = MD5.new(data).hexdigest()
- prvKey = PublicKey.RSA.importKey(prvKeyData)
- pub = prvKey.publickey()
- longSignature = number.bytes_to_long(signature)
- print 'VERIFY:', pub.verify(hash, (longSignature,) )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement