silk/certificate_path
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.
Deterministic bounded TLS-server certificate paths to explicit trust authority.
When to use
Use CertificatePath.validate after certificate decoding and before HTTPS identity and TLS
CertificateVerify checks. Supply every trust candidate explicitly as a TrustAnchor.
Details
Validation borrows all certificate input. It searches anchors first and then intermediates in
caller order. All resource and work bounds are finite and inclusive. One caller-supplied
Instant controls every date check.
Gotchas
A ValidatedPath does not authenticate a TLS connection. The caller must verify the service
identity, CertificateVerify, and Finished before it accepts application data. Revocation,
certificate transparency, network retrieval, and browser root policy are not checked.
Import as CertificatePath with import silk.certificate_path { CertificatePath }.
Public declarations: 9.
ValidationLimits
pub struct ValidationLimitsInclusive input and work limits for one path-validation call.
Field peerCertificates
pub peerCertificates: usizeMaximum peer certificates, including the leaf.
Field certificateBytes
pub certificateBytes: usizeMaximum DER bytes in each peer certificate.
Field peerBytes
pub peerBytes: usizeMaximum aggregate peer certificate DER bytes.
Field anchors
pub anchors: usizeMaximum explicit trust-anchor candidates.
Field anchorBytes
pub anchorBytes: usizeMaximum aggregate encoded trust-anchor bytes.
Field pathCertificates
pub pathCertificates: usizeMaximum selected path certificates, excluding the anchor and including the leaf.
Field issuerCandidates
pub issuerCandidates: usizeMaximum issuer-candidate visits.
Field signatureVerifications
pub signatureVerifications: usizeMaximum primitive signature verifications.
Field completePaths
pub completePaths: usizeMaximum reached anchored candidate paths.
Field nameComparisons
pub nameComparisons: usizeMaximum DNS or IP name/subtree comparisons.
Field profile
pub profile: ProfileLimitsBounds for each semantic certificate-profile inspection.
Associated function ValidationLimits.defaults
pub fn defaults() -> ValidationLimitsReturns the fixed default input, search, signature, path, comparison, and profile bounds.
Implementation Copy for ValidationLimits
impl Copy for ValidationLimitsValidationClass
pub enum ValidationClassThe broad category of a path-validation failure.
InvalidInput
InvalidInput = 0Caller input is invalid independently of trust-path selection.
Rejected
Rejected = 1The fixed certificate policy rejects all deterministic candidate paths.
ResourceLimit
ResourceLimit = 2An inclusive caller-supplied resource or work bound is exceeded.
ValidationReason
pub enum ValidationReasonStable path-validation rejection reasons.
UnsupportedVersion
UnsupportedVersion = 0The certificate version is outside the fixed role profile.
UnsupportedAlgorithm
UnsupportedAlgorithm = 1A required signature or key algorithm is unsupported.
UnsupportedParameters
UnsupportedParameters = 2Algorithm parameters are unsupported or inconsistent.
UnsupportedExtension
UnsupportedExtension = 3An extension needs unsupported processing.
UnsupportedConstraint
UnsupportedConstraint = 4A NameConstraints form is outside the DNS/IP subset.
UnsupportedPolicy
UnsupportedPolicy = 5Certificate policy processing is required but not implemented.
InvalidKey
InvalidKey = 6A public key is malformed or outside the admitted profile.
InvalidSignature
InvalidSignature = 7A retained certificate signature does not verify.
InvalidSerial
InvalidSerial = 8A path-certificate serial is invalid.
InvalidUsage
InvalidUsage = 9KeyUsage or ExtendedKeyUsage rejects the selected role.
InvalidBasicConstraints
InvalidBasicConstraints = 10BasicConstraints or CA-role policy rejects the certificate.
InvalidName
InvalidName = 11A subject name or subjectAltName is invalid.
InvalidTime
InvalidTime = 12A caller instant or certificate validity interval is invalid.
DuplicateExtension
DuplicateExtension = 13Two extensions contain the same OID.
IssuerMismatch
IssuerMismatch = 14Exact issuer and subject Name DER do not match.
NameConstraintViolation
NameConstraintViolation = 15A subordinate SAN violates cumulative NameConstraints.
PathLengthExceeded
PathLengthExceeded = 16An embedded or configured path-length restriction is exceeded.
Cycle
Cycle = 17A linked candidate repeats certificate DER already on the current path.
NoIssuer
NoIssuer = 18No supplied candidate has an exact linking subject Name.
NoValidPath
NoValidPath = 19Every deterministically visited linked path is rejected.
SizeOverflow
SizeOverflow = 20A checked length or counter sum is not representable.
ValidationLocation
pub union ValidationLocationThe input position associated with one validation failure.
Leaf
ValidationLocation.Leaf: ValidationLocationThe peer end-entity certificate.
Intermediate
ValidationLocation.Intermediate { index: usize }: ValidationLocationOne peer intermediate at its original caller index.
Field index
pub index: usizeThe original caller index.
Anchor
ValidationLocation.Anchor { index: usize }: ValidationLocationOne explicit trust anchor at its original caller index.
Field index
pub index: usizeThe original caller index.
Call
ValidationLocation.Call: ValidationLocationThe validation call rather than one certificate.
Implementation Copy for ValidationLocation
impl Copy for ValidationLocationValidationLimit
pub enum ValidationLimitA named inclusive validation bound.
PeerCertificates
PeerCertificates = 0Total peer certificate count, including the leaf.
CertificateBytes
CertificateBytes = 1DER bytes in one peer certificate.
PeerBytes
PeerBytes = 2Aggregate peer certificate DER bytes.
Anchors
Anchors = 3Explicit trust-anchor count.
AnchorBytes
AnchorBytes = 4Aggregate encoded trust-anchor bytes.
PathCertificates
PathCertificates = 5Selected path certificate count, excluding the anchor.
IssuerCandidates
IssuerCandidates = 6Issuer-candidate visits.
SignatureVerifications
SignatureVerifications = 7Primitive signature verifications.
CompletePaths
CompletePaths = 8Complete anchored candidate paths.
NameComparisons
NameComparisons = 9DNS or IP name/subtree comparisons.
ProfileExtensions
ProfileExtensions = 10Certificate-profile extension count.
ProfileExtensionBytes
ProfileExtensionBytes = 11One certificate-profile extension value size.
ProfileSanNames
ProfileSanNames = 12Certificate-profile subjectAltName count.
ProfileConstraintSubtrees
ProfileConstraintSubtrees = 13Certificate-profile NameConstraints subtree count.
ProfileNodes
ProfileNodes = 14Certificate-profile DER-node count.
ProfileDepth
ProfileDepth = 15Certificate-profile DER nesting depth.
Arithmetic
Arithmetic = 16Checked arithmetic representation.
ValidationError
pub struct ValidationErrorOwned scalar evidence for one failed validation call.
Field kind
pub kind: ValidationClassBroad failure category.
Field reason
pub reason: ValidationReasonStable primary reason.
Field detailReason
pub detailReason: silk/option.Option<silk/certificate_path.ValidationReason>First rejected-candidate detail when reason is NoValidPath.
Field location
pub location: ValidationLocationInput position associated with the primary or retained detail.
Field extensionIndex
pub extensionIndex: silk/option.Option<usize>Extension index when a profile failure belongs to an extension.
Field limit
pub limit: silk/option.Option<silk/certificate_path.ValidationLimit>Named bound for a resource-limit failure.
Field offset
pub offset: usizeByte offset in the relevant certificate or configured constraint input.
RevocationStatus
pub enum RevocationStatusRevocation evidence attached to a validated path.
NotChecked
NotChecked = 0No CRL, OCSP, must-staple, or other revocation check was performed.
ValidatedPath
pub struct ValidatedPath<'a>One borrowed selected path plus owned caller-order intermediate indices.
Method ValidatedPath.leaf
pub fn leaf<'a, 'life1>(self: &'life1 ValidatedPath<'a>) -> &'a silk/certificate.CertificateBorrows the exact caller-supplied leaf certificate.
Method ValidatedPath.anchorIndex
pub fn anchorIndex<'a, 'life1>(self: &'life1 ValidatedPath<'a>) -> usizeReturns the selected trust anchor's original caller index.
Method ValidatedPath.intermediateCount
pub fn intermediateCount<'a, 'life1>(self: &'life1 ValidatedPath<'a>) -> usizeReturns the number of selected peer intermediate certificates.
Method ValidatedPath.intermediateIndex
pub fn intermediateIndex<'a, 'life1>(self: &'life1 ValidatedPath<'a>, index: usize) -> silk/option.Option<usize>Returns one selected intermediate's original caller index, in leaf-to-anchor order.
Method ValidatedPath.validationTime
pub fn validationTime<'a, 'life1>(self: &'life1 ValidatedPath<'a>) -> InstantReturns the copied caller-supplied validation instant.
Method ValidatedPath.revocationStatus
pub fn revocationStatus<'a, 'life1>(self: &'life1 ValidatedPath<'a>) -> RevocationStatusReturns NotChecked because path validation performs no revocation operation.
CertificatePath
pub struct CertificatePathThe namespace for bounded deterministic certificate-path validation.
Associated function CertificatePath.validate
pub effect<'env> fn validate<'a: 'env, 'life1: 'env, 'env>(leaf: &'a silk/certificate.Certificate, intermediates: &'a [silk/certificate.Certificate], anchors: &'a [silk/trust_anchor.TrustAnchor], at: &'life1 silk/system_clock.Instant, limits: ValidationLimits) -> silk/result.Result<silk/certificate_path.ValidatedPath<'a>, silk/certificate_path.ValidationError> ! OutOfMemoryError ? &mut AllocatorBuilds and validates the first deterministic TLS-server path to explicit authority.
Details
The result borrows leaf, intermediates, and anchors for 'a. Search tries anchors in
caller order before intermediates in caller order at each depth. Counters span the complete
call and do not reset during backtracking.
Gotchas
Zero permits no corresponding input or operation. Work-budget exhaustion is terminal. An ordinary candidate rejection does not stop a later alternate path.