pub struct Spake2pProver { /* private fields */ }rustcrypto only.Expand description
The prover: a commissioner that knows the passcode (§3.10).
Implementations§
Source§impl Spake2pProver
impl Spake2pProver
Sourcepub fn new(
passcode: u32,
salt: &[u8],
iterations: u32,
random: &[u8; 32],
) -> Result<Self>
pub fn new( passcode: u32, salt: &[u8], iterations: u32, random: &[u8; 32], ) -> Result<Self>
Starts an exchange from a passcode and the PBKDF parameters the device announced.
random must be 32 octets of cryptographically secure randomness — the ephemeral
scalar x. A predictable x hands the session key to anyone watching.
Sourcepub fn from_parts(w0: &[u8; 32], w1: &[u8; 32], x: &[u8; 32]) -> Result<Self>
pub fn from_parts(w0: &[u8; 32], w1: &[u8; 32], x: &[u8; 32]) -> Result<Self>
Starts an exchange from w0 and w1 directly.
Spake2pProver::new derives those from a passcode, which is what a commissioner
reading a QR code does. This takes them ready-made — for a commissioner whose
PBKDF ran somewhere else, and for checking this implementation against the
published SPAKE2+ test vectors, which state w0 and w1 rather than a passcode.
Sourcepub fn finish(
&self,
pb: &[u8; 65],
context: &[u8],
) -> Result<(Confirmation, Confirmation, SharedSecret)>
pub fn finish( &self, pb: &[u8; 65], context: &[u8], ) -> Result<(Confirmation, Confirmation, SharedSecret)>
Given the commissionee’s pB, derives the keys and the confirmations.
Returns (cA to send, cB to expect, Ke). The caller must compare the peer’s cB
against the returned one with ct_eq, and abandon the session if
it differs: that comparison is the only thing standing between a correct passcode
and a wrong one.
Sourcepub fn finish_with_identities(
&self,
pb: &[u8; 65],
context: &[u8],
prover_identity: &[u8],
verifier_identity: &[u8],
) -> Result<(Confirmation, Confirmation, SharedSecret)>
pub fn finish_with_identities( &self, pb: &[u8; 65], context: &[u8], prover_identity: &[u8], verifier_identity: &[u8], ) -> Result<(Confirmation, Confirmation, SharedSecret)>
Spake2pProver::finish with explicit SPAKE2+ identities.
Matter uses neither identity, so Spake2pProver::finish is what a Matter
commissioner calls. This exists because SPAKE2+ itself has them, and because the
specification’s own published test vectors exercise all four combinations — being
able to run those is the difference between “our two halves agree” and “our
arithmetic is right”.