SolarEnergy/python_device/src/pki.py

6 lines
191 B
Python

from OpenSSL import crypto
def gen_priv_key():
key = crypto.PKey()
key.generate_key(crypto.TYPE_RSA, 2048)
return crypto.dump_privatekey(crypto.FILETYPE_PEM, key).decode("utf-8")