Reputation: 2158
I can obtain the private key (PEM format), but I'm not sure how to generate the public key:
from OpenSSL import crypto, SSL
key = crypto.PKey()
key.generate_key(crypto.TYPE_RSA, 1024)
priv_key = crypto.dump_privatekey(crypto.FILETYPE_PEM, key)
pub_key = ... ?
Upvotes: 1
Views: 1689
Reputation: 176
According to the pyopenssl docs
pub_key = crypto.dump_publickey(type, key)
where type = The file type (one of :data:FILETYPE_PEM
or :data:FILETYPE_ASN1
).
Hope this helps
Upvotes: 3