You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RSA/create ke

16 lines
408 B

from Crypto import Random
from Crypto.PublicKey import RSA
random_generator = Random.new().read
rsa = RSA.generate(1024, random_generator)
if __name__ == '__main__':
private_pem = rsa.exportKey()
with open("my-private.pem", "wb") as f:
f.write(private_pem)
public_pem = rsa.publickey().exportKey()
with open("my-public.pem", "wb") as f:
f.write(public_pem)