Created
December 30, 2020 03:11
-
-
Save igorhrq/f03bfb3122b5aa4057a6eb7e88d8f0c7 to your computer and use it in GitHub Desktop.
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
# Author: Igor Andrade | |
# generate a public and private key at /root dir | |
import os | |
from Crypto.PublicKey import RSA | |
key = RSA.generate(4096) | |
with open("/root/priv8.key", 'wb') as arquivo: | |
os.chmod("/root/priv8.key", 0o600) | |
arquivo.write(key.exportKey('PEM')) | |
pubkey = key.publickey() | |
with open("/root/public.pub", 'wb') as arquivo: | |
arquivo.write(pubkey.exportKey('OpenSSH')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment