This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/util/ssh.py

12 lines
313 B
Python
Raw Normal View History

2015-03-16 17:37:27 +00:00
from Crypto.PublicKey import RSA
def generate_ssh_key():
"""
Generates a new 2048 bit RSA private key in PEM format and public key in OpenSSH format.
"""
key = RSA.generate(2048)
private_pem = key.exportKey('PEM')
public_key = key.publicKey().exportKey('OpenSSH')
return (private_pem, public_key)