signer.formsΒΆ
Contains Logic for Form on Add/Edit Signer Page.
ClassesΒΆ
Form for selecting the method to add a Signer. |
|
Form for selecting the file type when importing a Signer. |
|
Form for importing an Signer using a PKCS#12 file. |
|
Form for importing a Signer using separate files. |
|
Form for signing a hash value with a selected signer. |
FunctionsΒΆ
Determine the appropriate PrivateKeyLocation based on KeyStorageConfig. |
Module ContentsΒΆ
- signer.forms.get_private_key_location_from_config()[source]ΒΆ
Determine the appropriate PrivateKeyLocation based on KeyStorageConfig.
- Return type:
trustpoint_core.serializer.PrivateKeyLocation
- class signer.forms.SignerAddMethodSelectForm(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 a Signer.
- class signer.forms.SignerAddFileTypeSelectForm(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 a Signer.
- class signer.forms.SignerAddFileImportPkcs12Form(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:
trustpoint.logger.LoggerMixin,django.forms.FormForm for importing an Signer using a PKCS#12 file.
- clean_unique_name()[source]ΒΆ
Validates the unique name to ensure it is not already in use.
- Return type:
str
- _raise_validation_error(message)[source]ΒΆ
Helper method to raise a ValidationError with a given message.
- Parameters:
message (str)
- Return type:
NoReturn
- _validate_pkcs12_file(cleaned_data)[source]ΒΆ
Validates and reads the PKCS#12 file.
- Parameters:
cleaned_data (dict[str, Any])
- Return type:
tuple[bytes, bytes | None]
- _process_pkcs12_file(pkcs12_raw, pkcs12_password, unique_name)[source]ΒΆ
Processes the PKCS#12 file and returns a credential serializer.
- Parameters:
pkcs12_raw (bytes)
pkcs12_password (bytes | None)
unique_name (str | None)
- Return type:
trustpoint_core.serializer.CredentialSerializer
- class signer.forms.SignerAddFileImportSeparateFilesForm(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:
trustpoint.logger.LoggerMixin,django.forms.FormForm for importing a Signer using separate files.
- clean_private_key_file()[source]ΒΆ
Validates and parses the uploaded private key file.
- Return type:
trustpoint_core.serializer.PrivateKeySerializer
- clean_signer_certificate()[source]ΒΆ
Validates and parses the uploaded signer certificate file.
- Return type:
trustpoint_core.serializer.CertificateSerializer
- clean_signer_certificate_chain()[source]ΒΆ
Validates and parses the uploaded signer certificate chain file.
- Return type:
None | trustpoint_core.serializer.CertificateCollectionSerializer
- _raise_validation_error(message)[source]ΒΆ
Helper method to raise a ValidationError with a given message.
- Parameters:
message (str)
- Return type:
None
- _validate_required_fields(cleaned_data)[source]ΒΆ
Validates required fields.
- Parameters:
cleaned_data (dict[str, Any])
- Return type:
None
- _create_credential_serializer(cleaned_data)[source]ΒΆ
Creates a credential serializer from the cleaned data.
- Parameters:
cleaned_data (dict[str, Any])
- Return type:
trustpoint_core.serializer.CredentialSerializer
- class signer.forms.SignHashForm(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:
trustpoint.logger.LoggerMixin,django.forms.FormForm for signing a hash value with a selected signer.