1
0
mirror of https://github.com/quay/quay.git synced 2026-01-27 18:42:52 +03:00
Files
quay/util/security/ssh.py
2020-02-05 19:55:07 -08:00

14 lines
371 B
Python

from __future__ import absolute_import
from Crypto.PublicKey import RSA
def generate_ssh_keypair():
"""
Generates a new 2048 bit RSA public key in OpenSSH format and private key in PEM format.
"""
key = RSA.generate(2048)
public_key = key.publickey().exportKey("OpenSSH")
private_key = key.exportKey("PEM")
return (public_key, private_key)