#[non_exhaustive]pub enum AttestationError {
Show 15 variants
Parse(Box<dyn Error + Send + Sync + 'static>),
InvalidChain(Box<dyn Error + Send + Sync + 'static>),
TimeBoundsViolation,
BasicConstraintsViolation,
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),
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
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.
UntrustedRoot
No PAA in the supplied crate::attestation::PaaTrustStore
matched the PAI’s issuer.
VidMismatch
Fields
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
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
CertificationDeclarationPidMismatch(ProductId)
Product ID list inside the verified Certification Declaration does not contain the PID the caller expected.
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_challengewas supplied (e.g. a replay or session-state mismatch), or attestation_elementswas 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
impl Debug for AttestationError
Source§impl Display for AttestationError
impl Display for AttestationError
Source§impl Error for AttestationError
impl Error for AttestationError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()