""" To view the RSA verification data: s = m^d mod n, and v = s^e mod n => signature = ( message ^ key.D ) mod key.N verify (or message) = ( signature ^ key.E ) mod key.N """ from Crypto.PublicKey import RSA from Crypto.Util import number kf = open('Key.pem', 'r') myPrivKey = RSA.importKey(kf.read()) kf.close() fin = open('Signature.bin', 'rb') signature = bytearray(fin.read()) fin.close() msg_long = number.bytes_to_long(signature) veridata = pow(msg_long, myPrivKey.e, myPrivKey.n) print("%x" %veridata)
2019年12月3日 星期二
How to View the RSA Verification Data
訂閱:
張貼留言 (Atom)
Binary Data, String, and Integer Conversions in Python
In Python 3, struct will interpret bytes as packed binary data: This module performs conversions between Python values and C structs rep...
-
Install C/C++ Extension for VS Code Select the working directory: in VS Code, File->Open Folder, select the directory for your co...
沒有留言:
張貼留言