|
|
|
Topics Codes RSA Public Keys Diffie-Hellman Modular Arithmetic Digital Signatures Nonrepudiation |
RSA: The simplicity
Encryption, Decryption: Basic Demonstration
>>> p 'This is a really cool message' >>> p_long = number.bytes_to_long(p) >>> p_long 2275631377870141336578401759413355859292272041852979859542858975504229L >>> p_str = number.long_to_bytes(p_long) >>> p_str 'This is a really cool message' >>> c_long = pow(p_long,Obj.e,Obj.n) >>> c_str = number.long_to_bytes(c_long) >>> c_long 3577359857149864104872582435988394681894692436564139372233149356497183396696626604420275454046346384499757690937676454298792444254247302261561478690808264L >>> c_str 'DM\xc5OC\x06\xa4\x94a\xa55\x96\x14P|4k@\xc65\xd3\t\x8fiK\xcd\x85_Oy\xda\x86`\x80\x92^Z\xfb\x9e\xa2\xde\x80\x08\x15\xa6\xb1\x00\x1c\x15\xa4\x85\xaa&\xd1_<\xf5\xe9z\xc2\xd2\xa2\xa1\xc8' >>> c_long_d = number.bytes_to_long(c_str) >>> p_long_d = pow(c_long_d,Obj.d,Obj.n) >>> Obj.e 65537L >>> Obj.d 3099234778655942655587865702037601270973126650452005339672950395413703554490867017690953509681134585322799088009268155598839343071612819885580126249710113L >>> Obj.n 6916892548570560661306383603420339672936005492616144183420607868694973262410116954423108364344944764719133340849158239328436916579807593845233379454432791L >>> p_str_d = number.long_to_bytes(p_long_d) >>> p_str_d 'This is a really cool message' >>>
Verification and Signatures
Little protection againdst evil-doers.
|