Skip to main content

CertificationElements

Struct CertificationElements 

Source
pub struct CertificationElements {
Show 15 fields pub format_version: u16, pub vendor_id: u16, pub product_ids: [u16; 100], pub product_ids_count: usize, pub device_type_id: u32, pub certificate_id: [u8; 19], pub security_level: u8, pub security_information: u16, pub version_number: u16, pub certification_type: CertificationType, pub dac_origin_vendor_id: u16, pub dac_origin_product_id: u16, pub dac_origin_vid_pid_present: bool, pub authorized_paa_list: [[u8; 20]; 10], pub authorized_paa_list_count: usize,
}
Expand description

Decoded Certification Declaration payload (Matter Spec.)

Fields§

§format_version: u16§vendor_id: u16§product_ids: [u16; 100]§product_ids_count: usize§device_type_id: u32§certificate_id: [u8; 19]§security_level: u8§security_information: u16§version_number: u16§certification_type: CertificationType§dac_origin_vendor_id: u16

DAC origin vendor ID (present only if dac_origin_vid_pid_present is true).

§dac_origin_product_id: u16

DAC origin product ID (present only if dac_origin_vid_pid_present is true).

§dac_origin_vid_pid_present: bool

Whether dac_origin_vendor_id and dac_origin_product_id are present.

§authorized_paa_list: [[u8; 20]; 10]

Authorized PAA Subject Key Identifiers.

§authorized_paa_list_count: usize

Number of entries in authorized_paa_list.

Implementations§

Source§

impl CertificationElements

Source

pub fn decode(cd_content: &[u8]) -> Result<CertificationElements, Error>

Decode a TLV-encoded CD payload into CertificationElements.

Validates the TLV structure, field types, and constraints per the Matter spec:

  • Tags 0-8 are mandatory and must appear in order.
  • Tags 9-10 (DAC origin) are optional but must appear together.
  • Tag 11 (authorized PAA list) is optional.
  • Product IDs array must have 1..=100 entries.
  • Certificate ID must be exactly 19 bytes.
  • Authorized PAA entries must each be exactly 20 bytes.
Source

pub fn verify<C>( crypto: C, cms_message: &[u8], allow_test_cd_signing_key: bool, ) -> Result<CertificationElements, Error>
where C: Crypto,

Verify a CMS-signed Certification Declaration.

  1. Parses the CMS envelope
  2. Looks up the signing key by Key ID in the well-known trust store
  3. Enforces test key policy (test keys only for DevelopmentAndTest/Provisional)
  4. Verifies the ECDSA-SHA256 signature over the CD content
  5. Decodes the CD TLV payload
§Arguments
  • crypto: Cryptographic backend for ECDSA verification.
  • cms_message: The complete CMS-signed CD message bytes.
  • allow_test_cd_signing_key: If false, CDs signed with the test key are rejected.
§Returns

The decoded CertificationElements on success.

Source

pub fn validate( &self, device_info: &DeviceInfoForAttestation, ) -> Result<(), Error>

Validate CD content against device identity.

Implements the CD validation rules (Matter Spec).

§Validation rules
  1. format_version must be 1.
  2. certification_type must be valid (0, 1, or 2) – already enforced by decoding.
  3. CD vendor_id must match device’s BasicInformation VendorID.
  4. Device’s BasicInformation ProductID must be in CD’s product_id_array.
  5. If dac_origin_vid_pid_present:
    • DAC VID must match dac_origin_vendor_id
    • PAI VID must match dac_origin_vendor_id
    • DAC PID must match dac_origin_product_id
    • If PAI has PID, it must match dac_origin_product_id
  6. If NOT dac_origin_vid_pid_present:
    • DAC VID must match CD vendor_id
    • PAI VID must match CD vendor_id
    • DAC PID must be in CD product_id_array
    • If PAI has PID, it must be in CD product_id_array
  7. If authorized_paa_list is present, PAA’s SKID must be in the list.

Note: security_level, security_information, and version_number are explicitly ignored per the specification.

Trait Implementations§

Source§

impl Debug for CertificationElements

Source§

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

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

impl Default for CertificationElements

Source§

fn default() -> CertificationElements

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

impl Eq for CertificationElements

Source§

impl PartialEq for CertificationElements

Source§

fn eq(&self, other: &CertificationElements) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CertificationElements

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, E> Init<T, E> for T

Source§

unsafe fn __init(self, slot: *mut T) -> Result<(), E>

Initializes slot. Read more
Source§

fn chain<F>(self, f: F) -> ChainInit<Self, F, T, E>
where F: FnOnce(&mut T) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, I> IntoFallibleInit<T> for I
where I: Init<T>,

Source§

fn into_fallible<E>(self) -> impl Init<T, E>

Convert the infallible initializer to a fallible one.
Source§

impl<Source, Target> OctetsInto<Target> for Source
where Target: OctetsFrom<Source>,

Source§

type Error = <Target as OctetsFrom<Source>>::Error

Source§

fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>

Performs the conversion.
Source§

fn octets_into(self) -> Target
where Self::Error: Into<Infallible>,

Performs an infallible conversion.
Source§

impl<T, E> PinInit<T, E> for T

Source§

unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E>

Initializes slot. Read more
Source§

fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>
where F: FnOnce(Pin<&mut T>) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V