Skip to main content

Spake2pVerifierData

Struct Spake2pVerifierData 

Source
pub struct Spake2pVerifierData {
    pub w0: [u8; 32],
    pub l: [u8; 65],
}
Available on crate feature rustcrypto only.
Expand description

What a commissionee stores instead of the passcode: (w0, L) (§3.10).

“When the computation of Crypto_PAKEValues_Responder is done, fields w0 and L SHALL be stored in the Responder and w1 SHALL NOT be stored in the Responder.”

This is what goes into a device’s factory data. It is 87 octets and it is not secret in the way a private key is — but it is not public either: anyone holding it can impersonate the device to a commissioner, so it is protected like a credential.

Fields§

§w0: [u8; 32]

w0 — a scalar, big-endian.

§l: [u8; 65]

L = w1 · P — an uncompressed point.

Implementations§

Source§

impl Spake2pVerifierData

Source

pub const LEN: usize

The size of the serialised form: w0 || L.

Source

pub fn from_passcode( passcode: u32, salt: &[u8], iterations: u32, ) -> Result<Self>

Computes (w0, L) from a passcode, as a factory-provisioning step would.

passcode is the §5.1.1.6 passcode; the PBKDF input is its little-endian 4-octet encoding — “passcode 18924017 would be encoded as the octet string f1:c1:20:01”.

Source

pub fn to_bytes(&self) -> [u8; 97]

Serialises as w0 || L.

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Self>

Reads w0 || L, checking that both halves are what they claim to be.

The validation is not decoration. §11.19.8.1’s OpenCommissioningWindow accepts a verifier from an administrator over the wire and must answer PAKEParameterError for one that is “incorrectly formatted or otherwise invalid” — and a verifier that was only length-checked would be accepted here and fail much later, inside PASE, as an inexplicable handshake failure that no commissioner could diagnose.

L goes through the same point decoding every peer-supplied point does: it must be on the curve and must not be the identity. The first is what stops an invalid-curve attack; the second is what stops a verifier that would make every Z the identity and every session key a constant. w0 must be a canonical scalar below the group order — a reduced-mod-n copy of an out-of-range value would be a different verifier that re-encodes to different bytes.

Trait Implementations§

Source§

impl Clone for Spake2pVerifierData

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Spake2pVerifierData

Source§

impl Debug for Spake2pVerifierData

Source§

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

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

impl Eq for Spake2pVerifierData

Source§

impl PartialEq for Spake2pVerifierData

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Spake2pVerifierData

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<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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.