Skip to main content

AttestationError

Enum AttestationError 

Source
#[non_exhaustive]
pub enum AttestationError {
Show 17 variants Parse(Box<dyn Error + Send + Sync + 'static>), InvalidChain(Box<dyn Error + Send + Sync + 'static>), TimeBoundsViolation, BasicConstraintsViolation, CertFormatViolation { reason: &'static str, }, UntrustedRoot, VidMismatch { dac: VendorId, pai: VendorId, }, PaiVidNotAuthorized, PaaVidScopeMismatch { paa_vid: VendorId, dac_vid: VendorId, }, ResponseElementsMalformed, CertificationDeclarationMalformed, CertificationDeclarationSignatureInvalid, CertificationDeclarationTlvMalformed, CertificationDeclarationVidMismatch { declared: VendorId, expected: VendorId, }, CertificationDeclarationPidMismatch(ProductId), CertificationDeclarationPaaNotAuthorized, BadResponseSignature,
}
Expand description

Errors produced by device attestation verification.

#[non_exhaustive] so future phases can add variants without a breaking change.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Parse(Box<dyn Error + Send + Sync + 'static>)

The DER bytes passed to one of crate::attestation::x509::Dac, crate::attestation::x509::Pai, or crate::attestation::x509::Paa’s from_der constructor failed to parse, or failed a Matter-specific subject-DN structural check (missing required VID/PID attribute, or — for crate::attestation::x509::Paa — a forbidden PID attribute).

§

InvalidChain(Box<dyn Error + Send + Sync + 'static>)

Path validation rejected the chain for a reason not captured by a more specific variant. Sources a boxed webpki::Error (downcastable via Error::downcast_ref on the trait object returned by source()) so callers who care about the underlying webpki kind can still inspect it without our public API mentioning webpki by type.

§

TimeBoundsViolation

One of the certs in the chain was outside its validity window at the supplied matter_cert::time::MatterTime.

§

BasicConstraintsViolation

A non-CA cert was marked BasicConstraints.cA = true, or the path-length-constraint was violated.

§

CertFormatViolation

The certificate breaches the Matter attestation certificate profile (Matter Core Spec §6.2.2) in a way other than BasicConstraints: a wrong version or signature algorithm, or a KeyUsage / SubjectKeyIdentifier / AuthorityKeyIdentifier extension that is absent, mis-flagged (wrong criticality or bits), duplicated, or malformed. Mirrors connectedhomeip’s VerifyAttestationCertificateFormat; rustls-webpki enforces none of these (it ignores KeyUsage and never requires SKID/AKID), so this check runs in our own code as a peer of crate::attestation::verify_chain. (BasicConstraints breaches surface as AttestationError::BasicConstraintsViolation.)

Fields

§reason: &'static str

Human-readable description of which profile rule failed.

§

UntrustedRoot

No PAA in the supplied crate::attestation::PaaTrustStore matched the PAI’s issuer.

§

VidMismatch

DAC subject VendorId did not equal PAI subject VendorId (Matter §6.2.3 requires equality).

Fields

§dac: VendorId

VendorId observed on the DAC subject.

§pai: VendorId

VendorId observed on the PAI subject.

§

PaiVidNotAuthorized

PAI is product-scoped (subject_pid is Some) and its crate::attestation::ProductId differs from the DAC’s. Matter §6.2.3: a scoped PAI authorises only the matching product.

§

PaaVidScopeMismatch

The PAA that anchored the chain is VID-scoped (its subject DN carries a VendorId) but that VID does not equal the DAC/PAI subject VID.

Matter Core Spec §6.2.2.1 requires a commissioner to verify that a VID-scoped PAA only anchors attestation chains whose DAC and PAI subject VID equal the PAA’s scoped VID. rustls-webpki performs only RFC 5280 DN-chaining — it treats the Matter VID OID as an opaque DN attribute, not as a NameConstraint — so without this overlay a VID-scoped PAA could anchor a chain for a different vendor. (chip’s DeviceAttestationVerifier enforces the same rule.)

Fields

§paa_vid: VendorId

VendorId the anchoring PAA is scoped to (its subject DN).

§dac_vid: VendorId

VendorId observed on the DAC/PAI subject (these two are already known equal by the time this check runs).

§

ResponseElementsMalformed

attestation_elements TLV failed to decode or is missing required fields (CD bytes, nonce, timestamp).

Returned by crate::attestation::extract_attestation_elements_fields when the outer shape is not an anonymous structure, the structure is truncated, a required context-tagged field (1 = CD bytes, 2 = nonce, 3 = timestamp) is missing or has the wrong wire type, the nonce is not exactly 32 bytes, or a required field appears more than once.

§

CertificationDeclarationMalformed

Certification Declaration (CD) has invalid CMS structure: it failed ContentInfo / SignedData DER parse, declared multiple signers, lacked an attached eContent, used an unexpected contentType / signatureAlgorithm, or otherwise did not match the Matter Core Spec §6.3.1 shape expected by crate::attestation::verify_certification_declaration.

§

CertificationDeclarationSignatureInvalid

Certification Declaration signature did not verify against any trusted root in the supplied crate::attestation::CdSigningRoots store.

§

CertificationDeclarationTlvMalformed

Certification Declaration inner TLV (the signed eContent payload) is malformed, truncated, or missing a required context-tagged field per Matter Core Spec §6.3.1.

§

CertificationDeclarationVidMismatch

Vendor ID declared inside the verified Certification Declaration does not equal the VID the caller expected (sourced from the verified DAC subject in M6.4.x).

Fields

§declared: VendorId

Vendor ID declared inside the CD’s inner TLV (tag 1).

§expected: VendorId

Vendor ID the caller required (typically the DAC subject’s VID).

§

CertificationDeclarationPidMismatch(ProductId)

Product ID list inside the verified Certification Declaration does not contain the PID the caller expected.

§

CertificationDeclarationPaaNotAuthorized

The Certification Declaration carries an authorized_paa_list (Matter Core Spec §6.3.1 tag 11) that does not include the SubjectKeyIdentifier of the PAA that anchored the device’s DAC chain. Per Matter §6.2.3 the device may only be attested under a PAA the CD authorizes, so this is a counterfeit-detection reject (chip DefaultDeviceAttestationVerifier.cpp:738). Also raised when the CD scopes its PAAs but the anchoring PAA carries no SKID to match.

§

BadResponseSignature

ECDSA verification of the device’s attestation-response signature over attestation_elements || attestation_challenge did not succeed against the DAC public key.

Deliberately coarse. Per the M6.2 design (§Error handling — information leakage table), this variant does NOT distinguish between

  • signature bytes corrupted in transit,
  • the device signed with a key other than the DAC’s,
  • the wrong attestation_challenge was supplied (e.g. a replay or session-state mismatch), or
  • attestation_elements was tampered.

A more granular surface here would let an attacker probe which of these failed, narrowing their guess for the actual session challenge.

Trait Implementations§

Source§

impl Debug for AttestationError

Source§

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

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

impl Display for AttestationError

Source§

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

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

impl Error for AttestationError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<AttestationError> for CommissioningError

Source§

fn from(source: AttestationError) -> Self

Converts to this type from the input type.

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.