Silk

silk/trust_anchor

Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc.

Owned explicit trust authority with independently configured path and name constraints.

When to use

Use TrustAnchor.fromCertificate when a decoded certificate is already explicit authority. Use fromCertificateWithConstraints to attach stricter local path-length or DNS/IP NameConstraints policy.

Details

A trust anchor owns the complete decoded certificate and any configured constraint DER. The configured constraints remain distinct from embedded certificate constraints, including when two anchors contain identical certificate bytes.

Gotchas

Constructing an anchor declares authority; it does not inspect a certificate profile, verify a self-signature, authenticate a path, or make native trust files equivalent to OS policy.

Import as TrustAnchor with import silk.trust_anchor { TrustAnchor }.

Public declarations: 1.

TrustAnchor

pub struct TrustAnchor

One owned trust candidate plus optional locally configured restrictions.

Associated function TrustAnchor.fromCertificate

pub fn fromCertificate(certificate: Certificate) -> TrustAnchor

Moves a decoded certificate into an unconstrained explicit trust anchor without allocating.

Details

All retained certificate bytes and unsupported extension values remain intact for later inspection. Authority does not imply that the certificate is supported by a selected profile.

Associated function TrustAnchor.fromCertificateWithConstraints

pub effect<'life0> fn fromCertificateWithConstraints<'life0>(certificate: Certificate, maximumPathLength: silk/option.Option<usize>, configuredNameConstraints: silk/option.Option<&'life0 [u8]>, limits: ProfileLimits) -> silk/result.Result<silk/trust_anchor.TrustAnchor, silk/certificate_profile.ProfileError> ! OutOfMemoryError ? &mut Allocator

Moves a decoded certificate into explicit authority with independent configured restrictions.

Details

Configured NameConstraints are validated under the strict DNS/IP subset and copied only after validation. The encoded-byte count includes complete certificate DER and configured constraint DER. On semantic failure the consumed certificate is dropped. Allocation refusal releases partial owned state through ordinary lexical destruction.

Method TrustAnchor.clone

pub effect<'life0> fn clone<'life0>(self: &'life0 TrustAnchor) -> TrustAnchor ! OutOfMemoryError ? &mut Allocator

Produces a byte- and constraint-preserving independent owner.

Details

Allocation refusal releases every partial copy and leaves the original unchanged.

Method TrustAnchor.certificate

pub fn certificate<'life0>(self: &'life0 TrustAnchor) -> &'life0 silk/certificate.Certificate

Borrows the complete owned decoded certificate.

Method TrustAnchor.configuredPathLength

pub fn configuredPathLength<'life0>(self: &'life0 TrustAnchor) -> silk/option.Option<usize>

Returns the independent configured maximum path length when present.

Method TrustAnchor.configuredNameConstraints

pub fn configuredNameConstraints<'life0>(self: &'life0 TrustAnchor) -> silk/option.Option<&'life0 [u8]>

Borrows exact configured NameConstraints DER when present.

Method TrustAnchor.encodedBytes

pub fn encodedBytes<'life0>(self: &'life0 TrustAnchor) -> usize

Returns certificate DER bytes plus configured NameConstraints DER bytes.

On this page