I want to decrypt a message with RSA
public key with PyCrypto
I am useing code below but getting no private key
error what should changed in code below?
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP
import base64
licence_key="bla bla"
licence_key_in_bytes=licence_key.encode("utf-8")
encrypted=base64.b16decode(licence_key_in_bytes)
key = open("public_key", "r").read()
rsakey = RSA.importKey(key)
rsakey = PKCS1_OAEP.new(rsakey)
decrypted_message= rsakey.decrypt(encrypted)
Furthermore, there may be differences in handling the keys
So the components of a private key will always match those of a public key. But as public keys normally have a small public exponent, public keys may not always be accepted as private keys.