tlslite.x509 module
Class representing an X.509 certificate.
- class tlslite.x509.X509[source]
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, “rsa-pss” for RSASSA-PSS, “ecdsa” for ECDSA
- getFingerprint()[source]
Get the hex-encoded fingerprint of this certificate.
- Return type:
- Returns:
A hex-encoded fingerprint.
- parse(s)[source]
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).
- tlslite.x509.bytes_to_int(bytes, byteorder='big', *, signed=False)
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.