Skip to main content

Module ca

Module ca 

Source
Available on crate feature rustcrypto only.
Expand description

The fabric’s certificate authority needs cert and crypto’s signing. A fabric’s certificate authority (Core §6.5) — issuing the identities a fabric is made of.

Every Matter fabric is rooted in one self-signed certificate, and every node on it holds a Node Operational Certificate chaining back to that root. §6.4.5.3 is blunt about what the root’s authority rests on:

Trust in the Root CA is established by provenance, not by the self-signature.

So a root is trusted because a commissioner installed it, and the CA’s real job is the other two: issuing an ICAC when the deployment wants one, and issuing a NOC for each node it commissions.

§This is the administrator’s half of commissioning

§11.18 gives the device’s half — it generates a key, signs a CSR, and takes back a NOC. The CSR carries a public key and nothing else the CA is obliged to believe, which is the point: the commissioner decides the node id, the fabric id and the CATs, and the device is told what it has become. A CA that echoed a subject from the CSR would let a device name itself.

§Keys stay in the store

Nothing here takes a private key. CertAuthority holds a KeyHandle and signs through the KeyStore, so a deployment with the CA key in a secure element works the same way as one with it in RAM — which is the case that matters, because this key is the fabric.

ⓘ
use matter_kit::ca::{CertAuthority, Validity};

// A fabric's root, self-signed, valid for ten years.
let mut buf = [0u8; matter_kit::cert::CERT_TLV_MAX];
let root = ca.self_signed_root(&keys, &mut buf, Validity::years(epoch_now, 10))?;

// ...and a node's operational certificate under it.
let mut buf = [0u8; matter_kit::cert::CERT_TLV_MAX];
let noc = ca.issue_noc(&keys, &mut buf, &Identity::new(fabric_id, node_id), &csr_key, validity)?;

Structs§

CertAuthority
A fabric’s certificate authority.
Identity
Who a NOC is for.
Validity
§6.5.5’s not-before/not-after, in seconds since the Matter epoch (2000-01-01 UTC).

Enums§

Authority
Which kind of authority a CertAuthority is.

Constants§

MAX_CATS
§6.5.6.3, on a NOC’s subject DN: “The subject DN MAY encode at most three matter-noc-cat attributes.”