pki.forms.owner_credential ========================== .. py:module:: pki.forms.owner_credential .. autoapi-nested-parse:: Django forms for owner credential management. Module Contents --------------- .. py:class:: OwnerCredentialFileImportForm(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) Bases: :py:obj:`trustpoint.logger.LoggerMixin`, :py:obj:`django.forms.Form` Form for importing an DevOwnerID using separate files. This form allows the user to upload a private key file, its password (optional), an DevOwnerID certificate file, and an optional certificate chain. The form validates the uploaded files, ensuring they are correctly formatted and within size limits. .. attribute:: unique_name A unique name for the Owner Credential. :type: CharField .. attribute:: private_key_file The private key file (.key, .pem). :type: FileField .. attribute:: private_key_file_password An optional password for the private key. :type: CharField .. attribute:: owner_certificate The DevOwnerID certificate file (.cer, .der, .pem, .p7b, .p7c). :type: FileField .. attribute:: owner_certificate_chain An optional certificate chain file. :type: FileField .. py:attribute:: unique_name .. py:attribute:: certificate .. py:attribute:: certificate_chain .. py:attribute:: private_key_file .. py:attribute:: private_key_file_password .. py:method:: clean_private_key_file() 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. :rtype: PrivateKeySerializer :raises ValidationError: If the private key file is missing, too large, or :raises corrupted, or if the password is invalid or incompatible.: .. py:method:: clean_certificate() Validates and parses the uploaded certificate file. This method ensures the provided certificate file is valid and not already associated with an existing DevOwnerID 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. :rtype: CertificateSerializer :raises ValidationError: If the file is missing, too large, corrupted, or already :raises associated with an existing Issuing CA.: .. py:method:: clean_certificate_chain() Validates and parses the uploaded 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. :rtype: CertificateCollectionSerializer :raises ValidationError: If the certificate chain cannot be parsed. .. py:method:: clean() 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 OwnerCredential configuration if all checks pass. :raises ValidationError: If the form data is invalid or there is an error during processing. .. py:class:: OwnerCredentialTruststoreAssociationForm(*args, **kwargs) Bases: :py:obj:`django.forms.Form` Form for associating a TLS truststore with a DevOwnerID's NoOnboardingConfig. .. py:attribute:: trust_store :type: django.forms.ModelChoiceField[Any] .. py:attribute:: instance :type: pki.models.OwnerCredentialModel .. py:method:: save() Save the selected truststore to the owner credential's config. .. py:class:: OwnerCredentialAddRequestEstNoOnboardingForm(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) Bases: :py:obj:`_OwnerCredentialEstBaseMixin` Form for requesting a DevOwnerID certificate via EST with username/password. .. py:attribute:: est_username .. py:attribute:: est_password .. py:method:: clean() Validate and save the owner credential via EST no-onboarding enrollment. .. py:class:: OwnerCredentialAddRequestEstOnboardingForm(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) Bases: :py:obj:`_OwnerCredentialEstBaseMixin` Form for requesting a DevOwnerID certificate via EST with IDevID-based onboarding. .. py:attribute:: remote_path_domain_credential .. py:attribute:: est_username .. py:attribute:: est_password .. py:method:: clean() Validate and prepare the owner credential via EST IDevID onboarding.