pub struct CaseResponder { /* private fields */ }rustcrypto only.Expand description
The device side of CASE: receives Sigma1, answers Sigma2, accepts Sigma3 (§4.14.2.3).
Implementations§
Source§impl CaseResponder
impl CaseResponder
Sourcepub fn new(session_id: SessionId, session_params: Option<SessionParams>) -> Self
pub fn new(session_id: SessionId, session_params: Option<SessionParams>) -> Self
A responder that will listen on session_id and announce session_params.
Sourcepub fn handle_sigma1<K: KeyStore>(
&mut self,
sigma1: &Sigma1<'_>,
fabric: &Fabric,
noc: &[u8],
icac: Option<&[u8]>,
keys: &mut K,
ephemeral_random: &[u8; 32],
responder_random: &[u8; 32],
resumption_random: &[u8; 16],
out: &mut [u8],
) -> Result<usize>
pub fn handle_sigma1<K: KeyStore>( &mut self, sigma1: &Sigma1<'_>, fabric: &Fabric, noc: &[u8], icac: Option<&[u8]>, keys: &mut K, ephemeral_random: &[u8; 32], responder_random: &[u8; 32], resumption_random: &[u8; 16], out: &mut [u8], ) -> Result<usize>
Handles a Sigma1 and writes the reply into out.
fabric is the one whose destinationId matched — found with
FabricTable::find_by_destination_identifier,
which is a search this function deliberately does not do: it needs the fabric table,
and threading the whole table through here would make the protocol depend on how a
node stores its fabrics.
ephemeral_random is 32 octets of entropy for the ephemeral key pair,
resumption_random 16 for the new resumption ID.
Sourcepub fn accept_sigma3<C: Config, const N: usize>(
&mut self,
sigma3: &Sigma3<'_>,
fabrics: &FabricTable<C, N>,
fabric: FabricIndex,
at: Option<u32>,
out: &mut [u8],
) -> Result<(CaseOutcome, usize)>
pub fn accept_sigma3<C: Config, const N: usize>( &mut self, sigma3: &Sigma3<'_>, fabrics: &FabricTable<C, N>, fabric: FabricIndex, at: Option<u32>, out: &mut [u8], ) -> Result<(CaseOutcome, usize)>
Validates a Sigma3 against the root of the fabric Sigma1 resolved, and writes the
SigmaFinished status report (§4.14.2.3).
fabric is the index accept_sigma1 returned, and using any other is the mistake this
exists to prevent: §4.14.2.3’s Validate Sigma3 checks the initiator’s certificate chain
against this fabric’s trusted root, and a chain that verifies against another root is a
chain from another administrator. Taking whichever root the table lists first works
perfectly on a node with one fabric and refuses every peer on the second — as
chain does not validate, which reads like a bad certificate and is not one.
at is the current Matter epoch-s, or None on a node without a clock (§6.4.5.1).
Sourcepub fn handle_sigma3(
&mut self,
sigma3: &Sigma3<'_>,
root: &MatterCertificate<'_>,
at: Option<u32>,
) -> Result<CaseOutcome>
pub fn handle_sigma3( &mut self, sigma3: &Sigma3<'_>, root: &MatterCertificate<'_>, at: Option<u32>, ) -> Result<CaseOutcome>
Handles a Sigma3, verifying the initiator’s chain and establishing the session.
root is the fabric’s trusted root certificate; at the current Matter epoch-s,
or None on a node without a clock (§6.4.5.1). Prefer
accept_sigma3, which takes the root from the fabric the
handshake is on rather than from the caller’s memory.
Source§impl CaseResponder
impl CaseResponder
Sourcepub fn handle_sigma1_resumption(
&mut self,
sigma1: &Sigma1<'_>,
previous: &ResumptionState,
resumption_random: &[u8; 16],
out: &mut [u8],
) -> Result<(usize, CaseOutcome)>
pub fn handle_sigma1_resumption( &mut self, sigma1: &Sigma1<'_>, previous: &ResumptionState, resumption_random: &[u8; 16], out: &mut [u8], ) -> Result<(usize, CaseOutcome)>
Handles a Sigma1 that asks for resumption, writing a Sigma2_Resume (§4.14.2.3).
previous is the remembered state the message’s resumptionID names — a lookup the
caller does, for the same reason the fabric lookup is the caller’s.
If the MIC does not verify, this returns ErrorCode::IntegrityCheckFailed and the
responder is still usable: the caller should fall back to
CaseResponder::handle_sigma1 with the same message, which is exactly what
§4.14.2.2 requires — “the information included in the Sigma1 with Resumption message
SHALL be processed as a Sigma1 message without any resumption fields.”