Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
def decrypt_RSA(private_key_loc, package):
param: public_key_loc Path to your private key
param: package String to be decrypted
return decrypted string
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP
from base64 import b64decode
key = open(private_key_loc, "r").read()
rsakey = RSA.importKey(key)
rsakey =
decrypted = rsakey.decrypt(b64decode(package))
return decrypted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment