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: u16DAC origin vendor ID (present only if dac_origin_vid_pid_present is true).
dac_origin_product_id: u16DAC origin product ID (present only if dac_origin_vid_pid_present is true).
dac_origin_vid_pid_present: boolWhether dac_origin_vendor_id and dac_origin_product_id are present.
Authorized PAA Subject Key Identifiers.
Number of entries in authorized_paa_list.
Implementations§
Source§impl CertificationElements
impl CertificationElements
Sourcepub fn decode(cd_content: &[u8]) -> Result<CertificationElements, Error>
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.
Sourcepub fn verify<C>(
crypto: C,
cms_message: &[u8],
allow_test_cd_signing_key: bool,
) -> Result<CertificationElements, Error>where
C: Crypto,
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.
- Parses the CMS envelope
- Looks up the signing key by Key ID in the well-known trust store
- Enforces test key policy (test keys only for DevelopmentAndTest/Provisional)
- Verifies the ECDSA-SHA256 signature over the CD content
- 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: Iffalse, CDs signed with the test key are rejected.
§Returns
The decoded CertificationElements on success.
Sourcepub fn validate(
&self,
device_info: &DeviceInfoForAttestation,
) -> Result<(), Error>
pub fn validate( &self, device_info: &DeviceInfoForAttestation, ) -> Result<(), Error>
Validate CD content against device identity.
Implements the CD validation rules (Matter Spec).
§Validation rules
format_versionmust be 1.certification_typemust be valid (0, 1, or 2) – already enforced by decoding.- CD
vendor_idmust match device’s BasicInformation VendorID. - Device’s BasicInformation ProductID must be in CD’s
product_id_array. - 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
- DAC VID must match
- 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
- DAC VID must match CD
- If
authorized_paa_listis 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
impl Debug for CertificationElements
Source§impl Default for CertificationElements
impl Default for CertificationElements
Source§fn default() -> CertificationElements
fn default() -> CertificationElements
impl Eq for CertificationElements
Source§impl PartialEq for CertificationElements
impl PartialEq for CertificationElements
impl StructuralPartialEq for CertificationElements
Auto Trait Implementations§
impl Freeze for CertificationElements
impl RefUnwindSafe for CertificationElements
impl Send for CertificationElements
impl Sync for CertificationElements
impl Unpin for CertificationElements
impl UnsafeUnpin for CertificationElements
impl UnwindSafe for CertificationElements
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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