Skip to main content

pakery_spake2plus/
registration.rs

1//! Registration helper for computing the SPAKE2+ verifier.
2//!
3//! During registration, the Prover derives `(w0, w1)` from the password
4//! (via password stretching), then computes `L = w1*G` and sends `(w0, L)`
5//! to the Verifier for storage.
6
7use alloc::vec::Vec;
8use pakery_core::crypto::CpaceGroup;
9
10use crate::ciphersuite::Spake2PlusCiphersuite;
11
12/// Compute the verifier point `L = w1*G` from the scalar `w1`.
13///
14/// The password stretching (e.g. PBKDF/Argon2 to derive w0, w1) is the
15/// caller's responsibility.
16pub fn compute_verifier<C: Spake2PlusCiphersuite>(
17    w1: &<C::Group as CpaceGroup>::Scalar,
18) -> Vec<u8> {
19    C::Group::basepoint_mul(w1).to_bytes()
20}