Module spake2

Module spake2 

Source
Expand description

SPAKE2 - Simple Password-Authenticated Key Exchange.

SPAKE2 is a password-authenticated key exchange (PAKE) protocol that allows two parties who share a password to derive a strong shared secret. It provides protection against offline dictionary attacks.

§Features

  • Symmetric PAKE (both parties use same password)
  • Protection against offline dictionary attacks
  • Forward secrecy
  • Simple and efficient

§Example

use chie_crypto::spake2::{Spake2, Spake2Side};

// Alice and Bob share a password
let password = b"shared-secret-password";

// Alice starts the protocol
let (alice, alice_msg) = Spake2::start(Spake2Side::Alice, password);

// Bob starts the protocol
let (bob, bob_msg) = Spake2::start(Spake2Side::Bob, password);

// They exchange messages and derive the shared secret
let alice_secret = alice.finish(&bob_msg).unwrap();
let bob_secret = bob.finish(&alice_msg).unwrap();

// Shared secrets match
assert_eq!(alice_secret, bob_secret);

Structs§

Spake2
SPAKE2 protocol state machine.
Spake2Message
SPAKE2 protocol message.
Spake2SharedSecret
Shared secret derived from SPAKE2.

Enums§

Spake2Error
SPAKE2 error types.
Spake2Side
Side in the SPAKE2 protocol (Alice or Bob).

Type Aliases§

Spake2Result
SPAKE2 result type.