commands.create_multiple_test_issuing_cas¶
Django management command for adding issuing CA test data.
Module Contents¶
- class commands.create_multiple_test_issuing_cas.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]¶
Bases:
commands.base_commands.CertificateCreationCommandMixin,django.core.management.base.BaseCommand,trustpoint.logger.LoggerMixinAdds a Root CA, Intermediate CAs, and Issuing CAs to the database.
- log_and_stdout(message, level='info')[source]¶
Log a message and write it to stdout.
- Parameters:
message (str) – The message to log and print.
level (str) – The logging level (‘info’, ‘warning’, ‘error’, etc.).
- Return type:
None
- get_ca_type_from_storage_config()[source]¶
Determine the CA type based on the crypto storage configuration.
- Returns:
The appropriate CA type.
- Return type:
- generate_empty_crl(ca_cert, private_key, hash_algorithm=hashes.SHA256(), crl_validity_hours=2400)[source]¶
Generate an empty CRL for a CA.
- Parameters:
ca_cert (cryptography.x509.Certificate) – The CA certificate.
private_key (cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey | cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey) – The private key of the CA.
hash_algorithm (cryptography.hazmat.primitives.hashes.HashAlgorithm) – The hash algorithm to use.
crl_validity_hours (int) – Validity period in hours.
- Returns:
The CRL in PEM format.
- Return type:
str
- verify_ca_certificate(ca_cert, issuer_cert=None, ca_name='CA')[source]¶
Verify a CA certificate against its issuer.
- Parameters:
ca_cert (cryptography.x509.Certificate) – The CA certificate to verify.
issuer_cert (cryptography.x509.Certificate | None) – The issuer CA certificate (for chain verification).
ca_name (str) – Name of the CA for logging purposes.
- Returns:
True if verification succeeds, False otherwise.
- Return type:
bool