silk.tls.trust_anchor.
A trust anchor: a CA certificate that you trust, with optional limits that you add.
When to use#
Make a TrustAnchor for each root CA that can start a certificate chain, and put the anchors
in a TrustSnapshot. Use TrustAnchor.fromCertificate to trust a certificate as it is. Use
TrustAnchor.fromCertificateWithConstraints to limit it more, for example to a maximum chain
length or to names under example.com.
Details#
The anchor owns its certificate. The limits that you add are kept apart from the limits inside the certificate, and path validation applies both.
Errors#
ProfileErrorfromTrustAnchor.fromCertificateWithConstraintsif the name constraints that you give are not valid or go over a limit.OutOfMemoryErrorif theAllocatorfails.
Gotchas#
Making an anchor gives a certificate full authority. It does not check the certificate, its self-signature, or its dates. Anchor only certificates that you trust.
Import as TrustAnchor with import silk.tls.trust_anchor { TrustAnchor }.
Public declarations: 1.
TrustAnchor#
pub struct TrustAnchorA CA certificate that you trust, with optional limits on chain length and names.
When to use#
Make one for each root CA that can start a certificate chain, and put the anchors in a
TrustSnapshot. Use TrustAnchor.fromCertificate to trust a certificate as it is. Use
TrustAnchor.fromCertificateWithConstraints to limit it more.
Details#
The anchor owns its certificate. The limits that you add are kept apart from the limits inside the certificate, and path validation applies both.
Gotchas#
Making an anchor gives a certificate full authority. It does not check the certificate, its self-signature, or its dates. Anchor only certificates that you trust.
Implementation TrustAnchor#
impl TrustAnchorAssociated function fromCertificate#
pub fn fromCertificate(certificate: Certificate) -> TrustAnchorReturns an anchor for certificate, with no limits that you add. It does not allocate or
check the certificate.
Associated function fromCertificateWithConstraints#
pub effect fn fromCertificateWithConstraints(
certificate: Certificate,
maximumPathLength: Option<usize>,
configuredNameConstraints: Option<&[u8]>,
limits: ProfileLimits,
) -> Result<TrustAnchor, ProfileError>
! OutOfMemoryError
? &mut AllocatorReturns an anchor for certificate, with a maximum chain length and name constraints that you
add.
maximumPathLength works like the pathLenConstraint of a basic constraints extension.
configuredNameConstraints is the DER of a NameConstraints value. Only DNS and IP address
constraints are supported. The anchor keeps a copy of it.
Errors#
Failurewith aProfileErrorif the name constraints are not valid or go overlimits. The certificate is dropped.OutOfMemoryErrorif theAllocatorfails.
Method clone#
pub effect fn clone(self: &Self) -> TrustAnchor ! OutOfMemoryError ? &mut AllocatorReturns a copy of the anchor, with its certificate and limits.
Errors#
OutOfMemoryErrorif theAllocatorfails. The original does not change.
Method certificate#
pub fn certificate(self: &Self) -> &CertificateReturns the certificate of the anchor.
Method configuredPathLength#
pub fn configuredPathLength(self: &Self) -> Option<usize>Returns the maximum chain length that you added, or None.
Method configuredNameConstraints#
pub fn configuredNameConstraints(self: &Self) -> Option<&[u8]>Returns the DER of the name constraints that you added, or None.
Method encodedBytes#
pub fn encodedBytes(self: &Self) -> usizeReturns the size of the certificate DER plus the name constraint DER. Snapshot limits count this value.
Category: TLS and certificates.
Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, wasm32-wasip1, wasm32-wasip2.