from Crypto.PublicKey import RSA
from Crypto.Util.number import *
key = generate(1024) # or 2048, 4096
To save key:
with open('savedKey.pem','wb') as f:
f.write(key.exportKey('PEM'))
To load key:
with open('savedKey.pem','r') as f:
key = RSA.importKey(f.read())
To encrypt:
c = pow(m, key.e, key.n)
To decrypt:
p = pow(m, key.d, key.n)
On this page of the site you can watch the video online Python3 RSA Encryption Decryption Basic with a duration of hours minute second in good quality, which was uploaded by the user Mike Root 09 February 2022, share the link with friends and acquaintances, this video has already been watched 750 times on youtube and it was liked by 9 viewers. Enjoy your viewing!