Quadratic formula in python for rsa decryption

broken image

Pu_key = RSA.importKey(open('public_pem.pem','r').read())ĭecrypt.py from Crypto.Cipher import PKCS1_OAEP Public_pem = pubKey().exportKey().decode() Private_pem = privKEY().exportKey().decode() If anyone can shed some light on this it would be greatly appreciated.įrom import pubkey I know this is wrong as I generate the public and private key, use the public key to encrypt and private to decrypt.

broken image

I believe the script thinks that the private_key it is using is not correct. I am able to read the private_key.pem in my decrypt.py script but it errors out. I am able to export the Private_key.pem, public_key.pem and even the secret.txt file. I am able to encrypt the text but when it comes to decrypting I get an error (See bottom of question).

broken image

So I have created 2 files one for encryption and other for decryption.

broken image