Re: error when import private key in python

2017-06-04 Thread Ho Yeung Lee
i use wb to write pubic and private key and succeed to import private, but after decrypt, it return hex number not a clear text from Crypto.PublicKey import RSA keypair = RSA.generate(2048) alice_privkey = keypair.exportKey('PEM', 'mysecret', pkcs=1) #alice_privkey = keypair.exportKey() alice_pubk

Re: error when import private key in python

2017-06-04 Thread Ho Yeung Lee
i use "wb" to write public and private key and succeed to import private key but after decrypt, it is not clear text, it is hex number from Crypto.PublicKey import RSA keypair = RSA.generate(2048) alice_privkey = keypair.exportKey('PEM', 'mysecret', pkcs=1) #alice_privkey = keypair.exportKey() al

Re: error when import private key in python

2017-06-04 Thread Thomas Jollans
On 04/06/17 13:22, Ho Yeung Lee wrote: > # [snip] > alice_privkey=text_file.read().replace('\n', '') Why are you removing newlines? Does the documentation tell you to do this? privkey = RSA.importKey(alice_privkey,passphrase="mysecret") > Traceback (most recent call last): > File "", line

error when import private key in python

2017-06-04 Thread Ho Yeung Lee
#step 1 from Crypto.PublicKey import RSA keypair = RSA.generate(2048) alice_privkey = keypair.exportKey('PEM', 'mysecret', pkcs=1) #alice_privkey = keypair.exportKey() alice_pubkey = keypair.publickey().exportKey() text_file = open("alice_pubkey.txt", "w") text_file.write(alice_pubkey) text_file.c