silk/certificate_bundle
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 certificate sequences decoded atomically from strict PEM input.
When to use
Use CertificateBundle for a PEM document with one or more CERTIFICATE blocks.
Use silk.certificate.Certificate when the input must contain exactly one certificate.
Details
A bundle preserves input order and duplicate certificates. Each certificate owns its DER bytes. All input, field, count, and traversal limits are inclusive. Zero never means unlimited. A failed call releases prior certificates and returns no partial bundle.
Gotchas
Successful decoding does not establish trust, signature validity, or certificate-path order. Explanatory text, unrelated PEM labels, and malformed later blocks fail the entire call.
Import as CertificateBundle with import silk.certificate_bundle { CertificateBundle }.
Public declarations: 1.
CertificateBundle
pub struct CertificateBundleAn immutable owned sequence that preserves every decoded certificate in input order.
Details
The bundle releases all certificate storage on drop. Borrowed certificates cannot outlive the bundle. Duplicate certificates remain separate entries. Decoding does not assign trust or chain order.
Associated function CertificateBundle.decodePem
pub effect<'life0> fn decodePem<'life0>(input: &'life0 [u8], limits: DecodeLimits) -> silk/result.Result<silk/certificate_bundle.CertificateBundle, silk/certificate.DecodeError> ! OutOfMemoryError ? &mut AllocatorDecodes all strict PEM certificate blocks into one owned result, or returns no bundle.
Details
The input remains borrowed until the Effect completes or is dropped. A successful result owns independent DER bytes.
Limits include whitespace and duplicate certificates. All limits are inclusive; zero is a zero budget.
Malformed input, unsupported labels, and exhausted limits return DecodeError in the result.
Allocation refusal uses OutOfMemoryError. Every failure releases accumulated certificates and scratch storage.
Gotchas
Only CERTIFICATE labels and SP, HT, CR, and LF whitespace are accepted. Explanatory text and malformed later blocks fail the entire document. This operation does not validate trust.
Method CertificateBundle.length
pub fn length<'life0>(self: &'life0 CertificateBundle) -> usizeReturns the number of certificates, including duplicate entries.
Method CertificateBundle.get
pub fn get<'a>(self: &'a CertificateBundle, index: usize) -> silk/option.Option<&'a silk/certificate.Certificate>Borrows the certificate at index, or returns None when the index is outside the bundle.
Details
The returned certificate cannot outlive this bundle. This operation allocates nothing and preserves input order.
Method CertificateBundle.intoCertificates
pub fn intoCertificates(self: CertificateBundle) -> silk/vector.Vector<silk/certificate.Certificate>Consumes the bundle and returns every owned certificate without allocating or copying DER.
When to use
Use this function when another owner must take the complete decoded sequence. Use get to
inspect one certificate without consuming the bundle.
Details
The returned vector preserves input order, duplicate entries, allocation, and capacity. This operation assigns no trust and performs no certificate validation.