Skip to content

Instantly share code, notes, and snippets.

@thanakijwanavit
Created July 4, 2020 23:25
Show Gist options
  • Save thanakijwanavit/80350c42d086bb0f1ddb7c47dbf694b8 to your computer and use it in GitHub Desktop.
Save thanakijwanavit/80350c42d086bb0f1ddb7c47dbf694b8 to your computer and use it in GitHub Desktop.
def generate_RSA(bits=2048):
new_key = RSA.generate(bits, e=65537)
public_key = new_key.publickey().exportKey("PEM").decode()
private_key = new_key.exportKey("PEM").decode()
return private_key, public_key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment