Skip to main content

Credentials

Struct Credentials 

Source
pub struct Credentials {
    pub noc: Vec<u8, OPERATIONAL_CERT_MAX>,
    pub icac: Option<Vec<u8, OPERATIONAL_CERT_MAX>>,
    pub rcac: Vec<u8, OPERATIONAL_CERT_MAX>,
    pub vvsc: Option<Vec<u8, OPERATIONAL_CERT_MAX>>,
}
Available on crate feature rustcrypto only.
Expand description

One fabric’s operational credential chain, as the NOCs and TrustedRootCertificates attributes serve it (§11.18.5.1, §11.18.5.5).

All three are Matter TLV certificates, not X.509 — §11.18.6.8 says “encoded using Matter Certificate Encoding” — and they are kept verbatim. A re-encoding would be a different octet string, and §6.5.2’s signature rule means a round-tripped certificate is one whose signature a peer may no longer be able to check.

Fields§

§noc: Vec<u8, OPERATIONAL_CERT_MAX>

NOC — the node operational certificate for this fabric.

§icac: Option<Vec<u8, OPERATIONAL_CERT_MAX>>

ICAC — the intermediate, if the chain has one. §11.18.4.4: “If no ICAC is present in the chain, this field SHALL be set to null.”

§rcac: Vec<u8, OPERATIONAL_CERT_MAX>

The trusted root, from AddTrustedRootCertificate. Served through TrustedRootCertificates rather than through NOCs: §11.18.4.4 keeps it out of NOCStruct deliberately, because several fabrics may share one root.

§vvsc: Option<Vec<u8, OPERATIONAL_CERT_MAX>>

VVSC — the Vendor Verification Signer Certificate (§11.18.4.4 field 3).

“The VVSC field is mutually exclusive with the ICAC field”: it exists for root-per-fabric deployments that have no intermediate to carry the signer, and Credentials::is_valid enforces the exclusion.

Implementations§

Source§

impl Credentials

Source

pub fn new(noc: &[u8], rcac: &[u8]) -> Result<Self>

A chain with a NOC and a root, and no intermediate.

Source

pub fn with_icac(self, icac: &[u8]) -> Result<Self>

The same chain with an intermediate.

Source

pub fn set_vvsc(&mut self, vvsc: &[u8]) -> Result<()>

Sets or erases the VVSC — SetVIDVerificationStatement (§11.18.6.14).

“If the length of the field’s value is exactly 0, then the VVSC field … SHALL be erased and the field SHALL disappear from the NOCs entry.”

Source

pub fn is_valid(&self) -> bool

Whether §11.18.4.4’s mutual exclusion holds.

Trait Implementations§

Source§

impl Clone for Credentials

Source§

fn clone(&self) -> Self

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 Debug for Credentials

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Credentials

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.