3.1.1 X509 objects

X509 objects have the following methods:

get_issuer()
Return a borrowed reference to a X509Name object representing the issuer of the certificate. When the corresponding X509 or X509Req object is destroyed, this object will be invalid!

get_pubkey()
Return a PKey object representing the public key of the certificate.

get_serial_number()
Return the certificate serial number.

get_subject()
Return a borrowed reference to a X509Name object representing the subject of the certificate. When the corresponding X509 or X509Req object is destroyed, this object will be invalid!

get_version()
Return the certificate version.

gmtime_adj_notBefore(time)
Adjust the timestamp (in GMT) when the certificate starts being valid.

gmtime_adj_notAfter(time)
Adjust the timestamp (in GMT) when the certificate stops being valid.

has_expired()
Checks the certificate's time stamp against current time. Returns true if the certificate has expired and false otherwise.

set_issuer(issuer)
Set the issuer of the certificate to issuer.

set_pubkey(pkey)
Set the public key of the certificate to pkey.

set_serial_number(serialno)
Set the serial number of the certificate to serialno.

set_subject(subject)
Set the subject of the certificate to subject.

set_version(version)
Set the certificate version to version.

sign(pkey, digest)
Sign the certificate, using the key pkey and the message digest algorithm identified by the string digest.

subject_name_hash()
Return the hash of the certificate subject.

digest(digest_name)
Return a digest of the certificate, using the digest_name method.

add_extensions(extensions)
Add the extensions in the sequence extensions to the certificate.