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