Skip to main content

CertificateChain

Struct CertificateChain 

Source
pub struct CertificateChain<'a> { /* private fields */ }
Expand description

A chain of Matter certificates, ordered from leaf to topmost intermediate. The root itself is supplied separately via TrustedRoots.

Implementations§

Source§

impl<'a> CertificateChain<'a>

Source

pub fn new(certs: &'a [MatterCertificate]) -> Self

Wrap a slice of certs as a chain.

Empty slices are accepted here — Self::validate is what rejects them (with Error::UntrustedRoot).

Source

pub fn len(&self) -> usize

Returns the number of certificates in this chain.

Source

pub fn is_empty(&self) -> bool

Returns true if this chain contains no certificates.

Source

pub fn validate(&self, roots: &TrustedRoots, at: MatterTime) -> Result<()>

Validate the chain against roots at the moment at.

Returns Ok(()) iff every per-cert check passes AND the topmost cert anchors against at least one entry in roots.

§Errors

Returns the most-specific Error variant identifying which check failed; for per-cert failures the variant carries cert_index (0 = leaf). Error::UntrustedRoot is returned for empty chains, no matching anchor, or anchor signature failure. Error::MissingKeyCertSign is returned when a non-leaf CA cert lacks the keyCertSign KeyUsage bit, and Error::LeafIsCa when the end-entity leaf asserts basic_constraints.is_ca = true. Returns any error MatterCertificate::to_x509_tbs_der returns for the top certificate.

Trait Implementations§

Source§

impl<'a> Clone for CertificateChain<'a>

Source§

fn clone(&self) -> CertificateChain<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for CertificateChain<'a>

Source§

impl<'a> Debug for CertificateChain<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for CertificateChain<'a>

§

impl<'a> RefUnwindSafe for CertificateChain<'a>

§

impl<'a> Send for CertificateChain<'a>

§

impl<'a> Sync for CertificateChain<'a>

§

impl<'a> Unpin for CertificateChain<'a>

§

impl<'a> UnsafeUnpin for CertificateChain<'a>

§

impl<'a> UnwindSafe for CertificateChain<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.