Created
November 13, 2020 19:28
-
-
Save PyMaster22/a5da50057ddcf0b1e5764004e72793f8 to your computer and use it in GitHub Desktop.
Generates RSA keys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, math | |
key_name = input("Private key name: ") | |
try: security = int(input("Secity level:\n[1] 1024\n[2] 2048\n[3] 4096\n[4] Custom\n\n[3]")) | |
except ValueError: security = 3 | |
if(security == 4): security = math.log2(int(input("Bits: "))) - 9 | |
cmd = "openssl genpkey -algorithm RSA -out ./"+key_name+" -pkeyopt rsa_keygen_bits:"+str(2 ** (int(security) + 9))+";openssl rsa -in ./"+key_name+" -pubout -out ./"+key_name+".pub" | |
os.system(cmd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment