3.1.5 PKey objects

The PKey object has the following methods:

bits()
Return the number of bits of the key.

generate_key(type, bits)
Generate a public/private key pair of the type type (one of TYPE_RSA and TYPE_DSA) with the size bits.

type()
Return the type of the key.

check()
Check the consistency of this key, returning True if it is consistent and raising an exception otherwise. This is only valid for RSA keys. See the OpenSSL RSA_check_key man page for further limitations.