CertificateRevocationList

Bases: InitCryptoParser

Represents a certificate revocation list (CRL).

Attributes:
  • issuer (Name) –

    The name of the issuer.

  • last_update (datetime) –

    The last update time of the CRL.

  • next_update (datetime) –

    The next update time of the CRL.

  • revoked_certs (Optional[List[RevokedCertificate]]) –

    List of revoked certificates.

tbs_bytes property
tbs_bytes: bytes

Return the bytes to be signed of the CRL.

Returns:
  • bytes

    TBS bytes of the CRL.

from_cryptography classmethod
from_cryptography(crypto_crl: x509.CertificateRevocationList) -> CertificateRevocationList

Create a CertificateRevocationList object from a cryptography CertificateRevocationList.

Parameters:
Returns:
from_uri classmethod
from_uri(uri: str, cache_time_seconds: int = CACHE_TIME_SECONDS) -> CertificateRevocationList

Loads CertificateRevocationList from a URI.

Parameters:
  • uri (str) –

    URI where the CRL can be downloaded.

  • cache_time_seconds (int, default: CACHE_TIME_SECONDS ) –

    Specifies how long the CRL should be cached, default is 1 month.

Returns:
  • CertificateRevocationList

    Instance of CertificateRevocationList containing the revoked certificates fetched from the URI.

get_revoked
get_revoked(cert_serial: int) -> Optional[RevokedCertificate]

Get a revoked certificate by serial number.

Parameters:
  • cert_serial (int) –

    Serial number of the certificate.

Returns:
sign
sign(private_key: CryptoPrivateKey, algorithm: Optional[SignatureAlgorithm] = None) -> None

Sign the CRL with the provided private key and algorithm.

Parameters:
  • private_key (CryptoPrivateKey) –

    Private key used to sign the CRL.

  • algorithm (Optional[SignatureAlgorithm], default: None ) –

    Signature algorithm to use for signing.

RevokedCertificate

Bases: CryptoParser

Represents a revoked certificate.

Attributes:
  • serial (int) –

    The serial number of the certificate.

  • date (datetime) –

    The revocation date of the certificate.

  • extensions (Optional[Extensions]) –

    Extensions associated with the certificate.

from_cryptography classmethod
from_cryptography(crypto_obj: x509.RevokedCertificate) -> RevokedCertificate

Create a RevokedCertificate object from a cryptography RevokedCertificate.

Parameters:
Returns: