cert_chain_resolver package¶
Submodules¶
cert_chain_resolver.cli module¶
cert_chain_resolver.exceptions module¶
cert_chain_resolver.models module¶
-
class
cert_chain_resolver.models.
Cert
(x509_obj)[source]¶ Bases:
object
The
Cert
object, which is a convenience wrapper for interacting with the underlyingcryptography.x509.Certificate
object- Parameters
x509_obj (
cryptography.x509.Certificate
) – An instance ofcryptography.x509.Certificate
- Raises
ValueError – given type is not an instance of
cryptography.x509.Certificate
-
property
common_name
¶ Extracted common name from the underlying
cryptography.x509.Certificate
object- Type
-
export
(encoding=<Encoding.PEM: 'PEM'>)[source]¶ Export the
cryptography.x509.Certificate
object”- Parameters
encoding (
cryptography.hazmat.primitives.serialization.Encoding
, optional) – The output format. Defaults to Encoding.PEM.- Returns
ascii formatted
- Return type
-
property
fingerprint
¶ ascii encoded sha256 fingerprint by calling
get_fingerprint()
- Type
-
get_fingerprint
(_hash=<class 'cryptography.hazmat.primitives.hashes.SHA256'>)[source]¶ Get fingerprint of the certificate
- Parameters
_hash (
cryptography.hazmat.primitives.hashes
, optional) – Hasher to use. Defaults to hashes.SHA256.- Returns
ascii formatted fingerprint
- Return type
-
property
issuer
¶ RFC4515 formatted string of the issuer field from the underlying
cryptography.x509.Certificate
object- Type
-
property
not_valid_after
¶ from the underlying
cryptography.x509.Certificate
object- Type
-
property
not_valid_before
¶ from the underlying
cryptography.x509.Certificate
object- Type
-
property
serial
¶ gets the serial from the underlying
cryptography.x509.Certificate
object- Type
-
property
signature_hash_algorithm
¶ gets the signature hashing algorithm name from the underlying
cryptography.x509.Certificate
object- Type
-
property
subject
¶ RFC4515 formatted string of the subject field from the underlying
cryptography.x509.Certificate
object- Type
-
property
subject_alternative_names
¶ Extracted x509 Extensions from the
cryptography.x509.Certificate
object
-
class
cert_chain_resolver.models.
CertificateChain
(chain=None)[source]¶ Bases:
object
Creates an iterable that contains a list of
Cert
objects.- Parameters
chain (
CertificateChain
, optional) – Create a new CertificateChain based on this chain. Defaults to None.
-
property
intermediates
¶ A new
CertificateChain
object with only intermediate certificates
cert_chain_resolver.resolver module¶
-
cert_chain_resolver.resolver.
resolve
(bytes_cert, _chain=None)[source]¶ A recursive function that follows the CA issuer chain
- Parameters
bytes_cert (bytes) – A DER/PKCS7/PEM certificate
_chain (
CertificateChain
, optional) – Chain to complete. Defaults to None.
- Returns
All resolved certificates in chain
- Return type
CertificateChain