I'm using pyOpenSSL, and when generating a request. I've basically been doing
import OpenSSL
from OpenSSL import crypto
key = crypto.PKey()
key.generate(crypto.TYPE_RSA, 1024)
req = crypto.X509Req()
req.get_subject().CN = "Anonymous"
req.set_pubkey(key)
req.sign(key, "sha1")
However, I feel I'm doing something wrong because I believe I just set the public key of the request to the private key instead of the public key.
I'm wondering if I did this wrong, and if so, how do I extract the public key from the private key pair in pyOpenSSL. It is unclear to me how to do this from the documentation.