pki.forms.issuing_casΒΆ
Django forms for issuing CA configuration and management.
Module ContentsΒΆ
- pki.forms.issuing_cas.get_private_key_location_from_config()[source]ΒΆ
Determine the appropriate PrivateKeyLocation based on KeyStorageConfig.
- Return type:
trustpoint_core.serializer.PrivateKeyLocation
- pki.forms.issuing_cas.get_ca_type_from_config()[source]ΒΆ
Determine the appropriate CA type based on KeyStorageConfig.
- Return type:
pki.models.CaModel.CaTypeChoice
- class pki.forms.issuing_cas.IssuingCaImportMixin[source]ΒΆ
Mixin for Issuing CA import forms providing common validation and creation logic.
- class pki.forms.issuing_cas.IssuingCaAddMethodSelectForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]ΒΆ
Bases:
django.forms.FormForm for selecting the method to add an Issuing Certificate Authority (CA).
This form provides options to choose the method for adding a new Issuing CA. Users can select between importing from a file, generating a key pair and requesting an Issuing CA certificate, or configuring a remote Issuing CA.
- class pki.forms.issuing_cas.IssuingCaFileTypeSelectForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]ΒΆ
Bases:
django.forms.FormForm for selecting the file type when importing an Issuing CA.
This form allows users to choose the type of file to use for importing an Issuing Certificate Authority (CA). Supported formats include PKCS#12 and other common certificate formats such as PEM, PKCS#1, PKCS#7, and PKCS#8.
- class pki.forms.issuing_cas.IssuingCaAddFileImportPkcs12Form(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]ΒΆ
Bases:
IssuingCaImportMixin,trustpoint.logger.LoggerMixin,django.forms.FormForm for importing an Issuing CA using a PKCS#12 file.
This form allows the user to upload a PKCS#12 file containing the private key and certificate chain, along with an optional password. It validates the uploaded file and its contents and ensures the unique name is not already used by another Issuing CA.
- clean()[source]ΒΆ
Cleans and validates the entire form.
This method performs additional validation on the cleaned data to ensure all required fields are valid and consistent. It checks the uploaded PKCS#12 file and its password (if provided) and validates that the unique name does not conflict with existing entries. Any issues during validation raise appropriate errors.
- Raises:
ValidationError β If the data is invalid, such as when the unique name
is already taken or the PKCS#12 file cannot be read or parsed. β
- Return type:
None
- class pki.forms.issuing_cas.IssuingCaAddFileImportSeparateFilesForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]ΒΆ
Bases:
IssuingCaImportMixin,trustpoint.logger.LoggerMixin,django.forms.FormForm for importing an Issuing CA using separate files.
This form allows the user to upload a private key file, its password (optional), an Issuing CA certificate file, and an optional certificate chain. The form validates the uploaded files, ensuring they are correctly formatted, within size limits, and not already associated with an existing Issuing CA.
- ca_certificate[source]ΒΆ
The Issuing CA certificate file (.cer, .der, .pem, .p7b, .p7c).
- Type:
FileField
- clean_private_key_file()[source]ΒΆ
Validates and parses the uploaded private key file.
This method checks if the private key file is provided, ensures it meets size constraints, and validates its contents. If a password is provided, it is used to decrypt the private key. Raises validation errors for missing, oversized, or corrupted private key files.
- Returns:
A serializer containing the parsed private key.
- Return type:
PrivateKeySerializer
- Raises:
ValidationError β If the private key file is missing, too large, or
corrupted, or if the password is invalid or incompatible. β
- clean_ca_certificate()[source]ΒΆ
Validates and parses the uploaded Issuing CA certificate file.
This method ensures the provided Issuing CA certificate file is valid and not already associated with an existing Issuing CA in the database. If the file is too large, corrupted, or already in use, a validation error is raised.
- Returns:
A serializer containing the parsed certificate.
- Return type:
- Raises:
ValidationError β If the file is missing, too large, corrupted, or already
associated with an existing Issuing CA. β
- clean_ca_certificate_chain()[source]ΒΆ
Validates and parses the uploaded Issuing CA certificate chain file.
This method checks if the optional certificate chain file is provided. If present, it validates and attempts to parse the file into a collection of certificates. Raises a validation error if parsing fails or the file appears corrupted.
- Returns:
A serializer containing the parsed certificate chain if provided.
- Return type:
CertificateCollectionSerializer
- Raises:
ValidationError β If the certificate chain cannot be parsed.
- clean()[source]ΒΆ
Cleans and validates the form data.
This method performs additional validation on the provided data, such as ensuring the unique name, private key file, and certificates are valid. It also initializes and saves the issuing CA configuration if all checks pass.
- Raises:
ValidationError β If the form data is invalid or there is an error during processing.
- Return type:
None
- class pki.forms.issuing_cas.IssuingCaAddRequestMixin[source]ΒΆ
Bases:
trustpoint.logger.LoggerMixin,django.forms.ModelForm[pki.models.CaModel]Mixin for forms requesting an Issuing CA certificate from remote servers.
- class pki.forms.issuing_cas.IssuingCaAddRequestEstForm(*args, **kwargs)[source]ΒΆ
Bases:
IssuingCaAddRequestMixinForm for requesting an Issuing CA certificate using EST.
- Parameters:
args (Any)
kwargs (Any)
- class pki.forms.issuing_cas.IssuingCaAddRequestCmpForm(*args, **kwargs)[source]ΒΆ
Bases:
IssuingCaAddRequestMixinGeneric form for configuring a remote CMP endpoint (CA or RA).
This form is used for both requesting an Issuing CA certificate via CMP and for setting up a remote CMP RA (Registration Authority) configuration.
Fields include remote host, port, path, and the shared secret for CMP authentication. The form can be extended or reused for both CA and RA scenarios.
- Parameters:
args (Any)
kwargs (Any)
- class pki.forms.issuing_cas.IssuingCaTruststoreAssociationForm(*args, **kwargs)[source]ΒΆ
Bases:
django.forms.FormForm for associating a truststore with an Issuing CA.
- Parameters:
args (Any)
kwargs (Any)
- class pki.forms.issuing_cas.IssuingCaCrlCycleForm[source]ΒΆ
Bases:
django.forms.ModelForm[pki.models.CaModel]Form for configuring CRL cycle settings for an Issuing CA.