RSA keygen

Creating RSA public and private keys. This is great script to create RSA tokens. This is used to keep your stuff locked down to only allow people that have these keys access.

import os
from Crypto.PublicKey import RSA
new_key = RSA.generate(2048, e=65537) 
public_key = new_key.publickey().exportKey("PEM") 
private_key = new_key.exportKey("PEM") 
with open("rsa_public.txt", "w") as f:
   print(public_key, file=f)
with open("rsa_private.txt", "w") as f:
   print(private_key, file=f)    

This is short and sweet but remember everything is connect 😉