"""
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...
-
In Python 3, struct will interpret bytes as packed binary data: This module performs conversions between Python values and C structs rep...
-
蝴蝶效應:上個世紀70年代,美國一個名叫洛倫茲的氣象學家在解釋空氣系統理論時說,亞馬遜雨林一只蝴蝶翅膀偶爾振動,也許兩周後就會引起美國得克薩斯州的一場龍卷風。 蝴蝶效應是說,初始條件十分微小的變化經過不斷放大,對其未來狀態會造成極其巨大的差別。有些小事可以糊塗,有些小...
-
""" To view the RSA verification data: s = m^d mod n, and v = s^e mod n => signature = ( message ^ key.D )...
沒有留言:
張貼留言