Added key gen and encryption with d in test program.
This commit is contained in:
parent
d4fecb787c
commit
ad95ca82da
@ -16,7 +16,7 @@ print(msg_list)
|
||||
|
||||
import rsa as en
|
||||
|
||||
key = en.readKeyFile('key')
|
||||
key = en.generateKeys()
|
||||
enc_list = list()
|
||||
pub_key = (key[0],key[1])
|
||||
for word in msg_list:
|
||||
@ -26,5 +26,14 @@ print(enc_list)
|
||||
unenc_list = list()
|
||||
|
||||
for enc_word in enc_list:
|
||||
unenc_list.append(en.decrypt(enc_word,key[2],key[0]).strip(('\x00')))
|
||||
print(unenc_list)
|
||||
unenc_list.append(str(en.decrypt(enc_word,key[2],key[0])).strip(('\x00')))
|
||||
print(unenc_list)
|
||||
|
||||
sig = "hesham"
|
||||
n = key[en.N]
|
||||
e = key[en.D] #encrypt with private key
|
||||
d = key[en.E]
|
||||
sig_enc = en.encrypt(sig,(n,e))
|
||||
print(sig_enc)
|
||||
sig_un = en.decrypt(sig_enc,d,n)
|
||||
print(sig_un)
|
Loading…
Reference in New Issue
Block a user