pki.models.domain

Module that contains the DomainModel.

Module Contents

class pki.models.domain.DomainModel(*args, **kwargs)[source]

Bases: django.db.models.Model

Domain Model.

unique_name[source]
issuing_ca[source]
is_active[source]
created_at[source]
updated_at[source]
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

clean()[source]

Validate that the issuing CA is not an auto-generated root CA.

Return type:

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:

pki.models.cert_profile.CertificateProfileModel

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

Model representing allowed certificate profiles for a domain.

domain[source]
certificate_profile[source]
alias[source]
class Meta[source]

Bases: django_stubs_ext.db.models.TypedModelMeta

Meta information.

constraints: ClassVar[source]
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]]