#ristretto #pake #key-exchange #crypto

cpace

An implementation of the CPace password-authenticated key exchange (PAKE)

1 unstable release

0.1.0 May 1, 2020

#6 in #pake

BSD-3-Clause

10KB
132 lines

cpace

A Rust implementation of the CPace PAKE, instantiated with the ristretto255 group.

This implementation is based on the go-cpace-ristretto255 implementation by Filippo Valsorda, and attempts to be compatible with it. Note that that implementation is loosely based on draft-haase-cpace-01, so all of these implementations are something of a moving target.

Documentation.


lib.rs:

An implementation of the CPace Password-Authenticated Key Exchange (PAKE) using Ristretto255. Note that this is an experimental implementation of a draft spec -- don't deploy it until 1.0.

This implementation is based on go-cpace-ristretto255 by Filippo Valsorda.

Example

use rand::rngs::OsRng;
use cpace;

let (init_msg, state) = cpace::init(
    "password",
    cpace::Context {
        initiator_id: "Alice",
        responder_id: "Bob",
        associated_data: b"",
    },
    OsRng,
)
.unwrap();

let (bob_key, rsp_msg) = cpace::respond(
    init_msg,
    "password",
    cpace::Context {
        initiator_id: "Alice",
        responder_id: "Bob",
        associated_data: b"",
    },
    OsRng,
)
.unwrap();

let alice_key = state.recv(rsp_msg).unwrap();

assert_eq!(alice_key.0[..], bob_key.0[..]);

Dependencies

~3MB
~58K SLoC