[][src]Crate cpace

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[..]);

Structs

AwaitingResponse

An intermediate initiator state.

Context

Contextual data bound to the resulting Key.

InitMessage

The message sent by the initiator to the responder.

Key

The output of the PAKE: a password-authenticated key.

ResponseMessage

The message sent by the responder to the initiator.

Enums

Error

An error that occurred while performing a PAKE.

Functions

init

Initiate a PAKE.

respond

Respond to a PAKE InitMessage.