silk/certificate_profile
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.
Borrowed semantic views for Silk's deliberately restricted TLS-server certificate profile.
When to use
Use CertificateProfile.inspect after structural certificate decoding and before path building.
Use verifyIssuedBy only to check exact issuer linkage and the retained certificate signature.
Details
Inspection is allocation-free, bounded, and retains the original certificate borrow. It admits role, key, signature metadata, and supported extension semantics while preserving original SAN and NameConstraints DER. Errors own only scalar metadata.
Gotchas
A successful profile inspection or issuer signature is not authentication. Neither operation checks current time, cumulative path constraints, trust authority, service identity, revocation, certificate transparency, or a complete path.
Import as CertificateProfile with import silk.certificate_profile { CertificateProfile }.
Public declarations: 10.
CertificateRole
pub enum CertificateRoleThe certificate's intended position in the restricted TLS-server profile.
ServerLeaf
ServerLeaf = 0A peer end-entity certificate inspected for admission to later TLS-server validation.
Intermediate
Intermediate = 1A non-anchor CA certificate below the trust endpoint.
Anchor
Anchor = 2An explicitly configured trust endpoint outside the returned path.
CertificateKeyKind
pub enum CertificateKeyKindThe admitted public-key algorithm and bounded key profile.
P256
P256 = 0An uncompressed validated secp256r1 point.
Rsa
Rsa = 1An odd 2048..4096-bit RSA modulus with exponent 65537.
ProfileLimits
pub struct ProfileLimitsInclusive budgets for one semantic inspection or configured-constraint validation.
Field extensions
pub extensions: usizeMaximum number of certificate extensions, including unknown and duplicate OIDs.
Field extensionBytes
pub extensionBytes: usizeMaximum bytes in each extension value, including opaque unknown noncritical values.
Field sanNames
pub sanNames: usizeMaximum names in one subjectAltName value.
Field constraintSubtrees
pub constraintSubtrees: usizeMaximum GeneralSubtree values across one NameConstraints value.
Field nodes
pub nodes: usizeMaximum traversed extension-value TLV nodes across one operation.
Field depth
pub depth: usizeMaximum traversed extension-value TLV depth; a value root has depth one.
Associated function ProfileLimits.defaults
pub fn defaults() -> ProfileLimitsReturns 64 extensions, 16384 bytes per value, 256 SAN names, 256 constraint subtrees, 4096 traversed nodes, and depth 16.
Implementation Copy for ProfileLimits
impl Copy for ProfileLimitsProfileClass
pub enum ProfileClassThe broad category of a semantic profile failure.
Malformed
Malformed = 0DER or recognized extension content violates the selected schema.
Unsupported
Unsupported = 1A well-formed value is outside the deliberately restricted profile.
ResourceLimit
ResourceLimit = 2A configured finite budget or target size bound is exceeded.
ProfileOffsetSpace
pub enum ProfileOffsetSpaceThe byte sequence in which a profile error offset is measured.
CertificateDer
CertificateDer = 0Offset in the complete decoded certificate DER.
ConfiguredConstraintDer
ConfiguredConstraintDer = 1Offset in caller-supplied configured NameConstraints DER.
ProfileReason
pub enum ProfileReasonThe stable semantic reason for a profile rejection.
Version
Version = 0The certificate version is invalid for the selected role.
Serial
Serial = 1A path-certificate serial is nonpositive, zero, or longer than 20 content octets.
UniqueIdentifier
UniqueIdentifier = 2An issuer or subject unique identifier is present.
PublicKey
PublicKey = 3The public-key algorithm, encoding, parameters, or mathematical key is not admitted.
SignatureAlgorithm
SignatureAlgorithm = 4The signature algorithm OID or signature BIT STRING metadata is not admitted.
SignatureParameters
SignatureParameters = 5A recognized signature algorithm has forbidden, missing, or unsupported parameters.
SignatureAlgorithmMismatch
SignatureAlgorithmMismatch = 6Inner and outer signature identifiers do not denote the same admitted effective algorithm.
Extensions
Extensions = 7More certificate extensions are present than the configured bound.
ExtensionBytes
ExtensionBytes = 8One extension value exceeds its configured byte bound.
DuplicateExtension
DuplicateExtension = 9A duplicate extension OID is present.
UnknownCriticalExtension
UnknownCriticalExtension = 10A critical extension has no supported semantics in this profile.
MalformedExtension
MalformedExtension = 11A recognized extension violates strict DER or its selected schema.
BasicConstraints
BasicConstraints = 12BasicConstraints conflicts with the role or path-length rules.
KeyUsage
KeyUsage = 13KeyUsage encoding or dependent bits are invalid.
MissingKeyUsage
MissingKeyUsage = 14A present KeyUsage does not authorize the selected role.
ExtendedKeyUsage
ExtendedKeyUsage = 15ExtendedKeyUsage is empty or malformed.
MissingServerAuth
MissingServerAuth = 16A present ExtendedKeyUsage omits id-kp-serverAuth.
SubjectAltName
SubjectAltName = 17subjectAltName is malformed or contains an invalid DNS/IP identity.
EmptySubject
EmptySubject = 18An empty subject lacks a nonempty critical subjectAltName.
UnsupportedCriticalName
UnsupportedCriticalName = 19A critical subjectAltName contains an unsupported GeneralName alternative.
NameConstraints
NameConstraints = 20NameConstraints is malformed, empty, noncritical, or used on an end entity.
UnsupportedNameConstraint
UnsupportedNameConstraint = 21A NameConstraints subtree form is outside the DNS/IP subset.
PolicyProcessing
PolicyProcessing = 22A certificate-policy feature requiring policy-tree processing is present.
TlsFeature
TlsFeature = 23TLS Feature is present although this profile cannot satisfy must-staple semantics.
Role
Role = 24The certificate role's CA or BasicConstraints policy is violated.
SanNames
SanNames = 25A SAN name count exceeds its configured bound.
ConstraintSubtrees
ConstraintSubtrees = 26A NameConstraints subtree count exceeds its configured bound.
Nodes
Nodes = 27The traversed extension-value node count exceeds its configured bound.
Depth
Depth = 28The traversed extension-value depth exceeds its configured bound.
SizeOverflow
SizeOverflow = 29Checked size or counter arithmetic cannot be represented.
IssuerName
IssuerName = 30The subject issuer Name DER does not exactly equal the issuer subject Name DER.
SignatureRejected
SignatureRejected = 31An admitted cryptographic primitive rejected the retained signature.
NameConstraintViolation
NameConstraintViolation = 32A subordinate DNS or IP subjectAltName violates one NameConstraints source.
NameComparisons
NameComparisons = 33The caller-supplied name/subtree comparison budget is exhausted.
ProfileError
pub struct ProfileErrorAn owned certificate-profile error with optional extension context and a stable byte offset.
Field kind
pub kind: ProfileClassBroad failure category.
Field reason
pub reason: ProfileReasonStable semantic failure reason.
Field extensionIndex
pub extensionIndex: silk/option.Option<usize>Zero-based extension index when the failure belongs to one certificate extension.
Field offsetSpace
pub offsetSpace: ProfileOffsetSpaceCoordinate system for offset.
Field offset
pub offset: usizeByte offset in the selected coordinate system.
KeyUsage
pub struct KeyUsageParsed KeyUsage bits retained independently of their original DER positions.
Field digitalSignature
pub digitalSignature: booldigitalSignature bit.
Field contentCommitment
pub contentCommitment: boolcontentCommitment/nonRepudiation bit.
Field keyEncipherment
pub keyEncipherment: boolkeyEncipherment bit.
Field dataEncipherment
pub dataEncipherment: booldataEncipherment bit.
Field keyAgreement
pub keyAgreement: boolkeyAgreement bit.
Field keyCertSign
pub keyCertSign: boolkeyCertSign bit.
Field crlSign
pub crlSign: boolcRLSign bit.
Field encipherOnly
pub encipherOnly: boolencipherOnly bit.
Field decipherOnly
pub decipherOnly: booldecipherOnly bit.
Implementation Copy for KeyUsage
impl Copy for KeyUsageExtendedKeyUsage
pub struct ExtendedKeyUsageParsed ExtendedKeyUsage facts used by the restricted TLS-server profile.
Field serverAuth
pub serverAuth: boolWhether id-kp-serverAuth occurs.
Field anyExtendedKeyUsage
pub anyExtendedKeyUsage: boolWhether anyExtendedKeyUsage occurs; it never substitutes for serverAuth.
Field purposeCount
pub purposeCount: usizeNumber of key-purpose identifiers in the original extension.
Implementation Copy for ExtendedKeyUsage
impl Copy for ExtendedKeyUsageCertificateProfile
pub struct CertificateProfile<'a>One immutable borrowed semantic view over a complete decoded certificate.
Associated function CertificateProfile.inspect
pub fn inspect<'a>(certificate: &'a silk/certificate.Certificate, selectedRole: CertificateRole, limits: ProfileLimits) -> silk/result.Result<silk/certificate_profile.CertificateProfile<'a>, silk/certificate_profile.ProfileError>Inspects one decoded certificate under the restricted TLS-server semantic profile.
Details
Inspection is allocation-free and bounded. It admits one role, validates key and extension policy, and caches immutable borrowed views. Path certificates also require matching admitted inner and outer signature metadata. Anchor signature metadata, serial, validity, and self-signature are deliberately ignored.
Gotchas
Success does not establish trust, current validity, a complete path, service identity, or an
actual signature. An anchor must be supplied through silk.trust_anchor as explicit authority.
Method CertificateProfile.certificate
pub fn certificate<'a, 'life1>(self: &'life1 CertificateProfile<'a>) -> &'a silk/certificate.CertificateBorrows the structurally decoded certificate retained by this view.
Method CertificateProfile.certificateRole
pub fn certificateRole<'a, 'life1>(self: &'life1 CertificateProfile<'a>) -> CertificateRoleReturns the role under which this certificate was inspected.
Method CertificateProfile.keyKind
pub fn keyKind<'a, 'life1>(self: &'life1 CertificateProfile<'a>) -> CertificateKeyKindReturns the admitted public-key profile.
Method CertificateProfile.ca
pub fn ca<'a, 'life1>(self: &'life1 CertificateProfile<'a>) -> boolReturns the admitted BasicConstraints CA value, or false when absent.
Method CertificateProfile.pathLength
pub fn pathLength<'a, 'life1>(self: &'life1 CertificateProfile<'a>) -> silk/option.Option<usize>Returns the admitted BasicConstraints path length when present.
Method CertificateProfile.keyUsage
pub fn keyUsage<'a, 'life1>(self: &'life1 CertificateProfile<'a>) -> silk/option.Option<silk/certificate_profile.KeyUsage>Returns admitted KeyUsage facts when the extension was present.
Method CertificateProfile.extendedKeyUsage
pub fn extendedKeyUsage<'a, 'life1>(self: &'life1 CertificateProfile<'a>) -> silk/option.Option<silk/certificate_profile.ExtendedKeyUsage>Returns admitted ExtendedKeyUsage facts when the extension was present.
Method CertificateProfile.subjectAltNamesDer
pub fn subjectAltNamesDer<'a, 'life1>(self: &'life1 CertificateProfile<'a>) -> silk/option.Option<&'a [u8]>Borrows the exact subjectAltName extension-value DER when present.
Method CertificateProfile.nameConstraintsDer
pub fn nameConstraintsDer<'a, 'life1>(self: &'life1 CertificateProfile<'a>) -> silk/option.Option<&'a [u8]>Borrows the exact embedded NameConstraints extension-value DER when present.
Associated function CertificateProfile.validateConfiguredNameConstraints
pub fn validateConfiguredNameConstraints<'life1>(value: &'life1 [u8], limits: ProfileLimits) -> silk/result.Result<(), silk/certificate_profile.ProfileError>Validates strict configured DNS/IP NameConstraints without allocating or retaining input.
Associated function CertificateProfile.checkNameConstraints
pub fn checkNameConstraints<'life1, 'life2, 'life3, 'life4>(subject: &'life1 silk/certificate_profile.CertificateProfile<'life2>, constraintDer: &'life3 [u8], comparisons: &'life4 mut usize, maximumComparisons: usize, offsetSpace: ProfileOffsetSpace) -> silk/result.Result<(), silk/certificate_profile.ProfileError>Checks every DNS and IP subjectAltName against one strict NameConstraints value.
Details
Exclusions run before permissions. The operation consumes one comparison before each
same-form name/subtree comparison and updates comparisons across calls. offsetSpace
identifies the coordinate system used by any returned constraint error.
Gotchas
The constraint value must first pass validateConfiguredNameConstraints or profile
inspection. The operation checks only one constraint source; callers must apply all sources.
Associated function CertificateProfile.verifyIssuedBy
pub fn verifyIssuedBy<'life1, 'life2, 'life3, 'life4>(subject: &'life1 silk/certificate_profile.CertificateProfile<'life2>, issuer: &'life3 silk/certificate_profile.CertificateProfile<'life4>) -> silk/result.Result<(), silk/certificate_profile.ProfileError>Verifies exact issuer-name linkage and the subject's retained original TBS signature.
Gotchas
This checks only one edge. It does not establish path, time, constraint, trust, or identity authentication.
Implementation Copy for silk/certificate_profile.CertificateProfile<'a>
impl Copy for silk/certificate_profile.CertificateProfile<'a>