pki.models.domain¶
Module that contains the DomainModel.
Module Contents¶
- class pki.models.domain.DomainModel(*args, **kwargs)[source]¶
Bases:
django.db.models.ModelDomain Model.
- save(**kwargs)[source]¶
Save the Domain model and add default certificate profiles.
- Parameters:
kwargs (Any)
- Return type:
None
- property signature_suite: trustpoint_core.oid.SignatureSuite | None[source]¶
Get the signature suite for the domain (based on its Issuing CA).
Returns None if the issuing CA doesn’t have a certificate yet.
- Return type:
trustpoint_core.oid.SignatureSuite | None
- property public_key_info: trustpoint_core.oid.PublicKeyInfo | None[source]¶
Get the public key info for the domain (based on its Issuing CA).
Returns None if the issuing CA doesn’t have a certificate yet.
- Return type:
trustpoint_core.oid.PublicKeyInfo | None
- get_issuing_ca_or_value_error()[source]¶
Gets the corresponding Issuing CA.
- Returns:
The corresponding Issuing CA.
- Raises:
ValueError – If no Issuing CA is set.
- Return type:
pki.models.CaModel
- get_allowed_cert_profiles()[source]¶
Gets the allowed certificate profiles for this domain.
- Returns:
QuerySet of allowed DomainAllowedCertificateProfileModel instances.
- Return type:
django.db.models.QuerySet[DomainAllowedCertificateProfileModel]
- get_allowed_cert_profile_names()[source]¶
Gets the set of allowed certificate profile names for this domain.
- Returns:
Set of allowed certificate profile names.
- Return type:
set[str]
- get_allowed_cert_profile(cert_profile_str)[source]¶
Gets the requested certificate profile if it is allowed for this domain. Else, raises a ValueError.
- Parameters:
cert_profile_str (str) – The name of the certificate profile to check.
- Returns:
The requested CertificateProfileModel (if allowed).
- Return type:
- set_allowed_cert_profiles(allowed_profile_data)[source]¶
Sets the certificate profiles allowed in the domain.
- Parameters:
allowed_profile_data (dict[str, str]) – Dict where key is allowed certificate profile ID (str) and value is optional alias
- Returns:
Set of rejected aliases due to duplication in the form of (alias, profile unique name)
- Return type:
set[tuple[str, str]]
- class pki.models.domain.DomainAllowedCertificateProfileModel(*args, **kwargs)[source]¶
Bases:
django.db.models.ModelModel representing allowed certificate profiles for a domain.
- static get_list_of_display_names(allowed_profiles)[source]¶
Get display names for the allowed certificate profiles, ensuring uniqueness.
Returns a list of tuples containing (profile_id, display_name, unique_name). If multiple profiles share the same display name, the unique name will be appended to the display name for disambiguation.
- Parameters:
allowed_profiles (list[DomainAllowedCertificateProfileModel])
- Return type:
list[tuple[int, str, str]]