"""
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...
-
""" To view the RSA verification data: s = m^d mod n, and v = s^e mod n => signature = ( message ^ key.D )...
-
書名: 醉漢走路 - 機率如何左右你我的命運和機會 The Drunkard’s Walk - How Randomness Rules Our Lives 原文作者: Leonard Mlodinow 譯者: 胡守仁 序 你的直覺正確嗎? 第一章 命運就...
沒有留言:
張貼留言