srp_conflux/
lib.rs

1#![allow(clippy::many_single_char_names)]
2#![doc(html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo_small.png")]
3#![doc = include_str!("../README.md")]
4
5//! # Usage
6//! Add `srp-conflux` dependency to your `Cargo.toml`:
7//!
8//! ```toml
9//! [dependencies]
10//! srp-conflux = "0.6"
11//! ```
12//!
13//! Next read documentation for [`client`](client/index.html) and
14//! [`server`](server/index.html) modules.
15//!
16//! # Algorithm description
17//! Here we briefly describe implemented algorithm. For additional information
18//! refer to SRP literature. All arithmetic is done modulo `N`, where `N` is a
19//! large safe prime (`N = 2q+1`, where `q` is prime). Additionally `g` MUST be
20//! a generator modulo `N`. It's STRONGLY recommended to use SRP parameters
21//! provided by this crate in the [`groups`](groups/index.html) module.
22//!
23//! |       Client           |   Data transfer   |      Server                     |
24//! |------------------------|-------------------|---------------------------------|
25//! |`a_pub = g^a`           | — `a_pub`, `I` —> | (lookup `s`, `v` for given `I`) |
26//! |`x = PH(P, s)`          | <— `b_pub`, `s` — | `b_pub = k*v + g^b`             |
27//! |`u = H(a_pub ‖ b_pub)`  |                   | `u = H(a_pub ‖ b_pub)`          |
28//! |`s = (b_pub - k*g^x)^(a+u*x)` |             | `S = (b_pub - k*g^x)^(a+u*x)`   |
29//! |`K = H(s)`              |                   | `K = H(s)`                      |
30//! |`M1 = H(A ‖ B ‖ K)`     |     — `M1` —>     | (verify `M1`)                   |
31//! |(verify `M2`)           |    <— `M2` —      | `M2 = H(A ‖ M1 ‖ K)`            |
32//!
33//! Variables and notations have the following meaning:
34//!
35//! - `I` — user identity (username)
36//! - `P` — user password
37//! - `H` — one-way hash function
38//! - `PH` — password hashing algroithm, in the RFC 5054 described as
39//! `H(s ‖ H(I ‖ ":" ‖ P))`
40//! - `^` — (modular) exponentiation
41//! - `‖` — concatenation
42//! - `x` — user private key
43//! - `s` — salt generated by user and stored on the server
44//! - `v` — password verifier equal to `g^x` and stored on the server
45//! - `a`, `b` — secret ephemeral values (at least 256 bits in length)
46//! - `A`, `B` — Public ephemeral values
47//! - `u` — scrambling parameter
48//! - `k` — multiplier parameter (`k = H(N || g)` in SRP-6a)
49//!
50//! [1]: https://en.wikipedia.org/wiki/Secure_Remote_Password_protocol
51//! [2]: https://tools.ietf.org/html/rfc5054
52
53pub mod client;
54pub mod groups;
55pub mod server;
56pub mod types;
57pub mod utils;