tlslite.x509 module¶
Class representing an X.509 certificate.
- class tlslite.x509.X509¶
Bases:
object
This class represents an X.509 certificate.
- Variables:
bytes (bytearray) – The DER-encoded ASN.1 certificate
publicKey (RSAKey) – The subject public key from the certificate.
subject (bytearray) – The DER-encoded ASN.1 subject distinguished name.
certAlg (str) – algorithm of the public key, “rsa” for RSASSA-PKCS#1 v1.5 and “rsa-pss” for RSASSA-PSS
- __init__()¶
Create empty certificate object.
- getFingerprint()¶
Get the hex-encoded fingerprint of this certificate.
- Return type:
str
- Returns:
A hex-encoded fingerprint.
- parse(s)¶
Parse a PEM-encoded X.509 certificate.
- Parameters:
s (str) – A PEM-encoded X.509 certificate (i.e. a base64-encoded certificate wrapped with “—–BEGIN CERTIFICATE—–” and “—–END CERTIFICATE—–” tags).
- parseBinary(bytes)¶
Parse a DER-encoded X.509 certificate.
- Parameters:
bytes (str or L{bytearray} of unsigned bytes) – A DER-encoded X.509 certificate.
- writeBytes()¶
Serialise object to a DER encoded string.