commands.create_multiple_test_issuing_cas

Django management command for adding issuing CA test data.

Classes

Command

Adds a Root CA, Intermediate CAs, and Issuing CAs to the database.

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.LoggerMixin

Adds a Root CA, Intermediate CAs, and Issuing CAs to the database.

help = 'Adds a Root CA, Intermediate CAs, and Issuing CAs to the database.'[source]
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:

CaModel.CaTypeChoice

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

handle(*_args, **_kwargs)[source]

Adds a Root CA and three issuing CAs to the database.

Parameters:
  • _args (tuple[str])

  • _kwargs (dict[str, str])

Return type:

None