rust_srp

Crates.iorust_srp
lib.rsrust_srp
version0.1.8
sourcesrc
created_at2021-01-31 11:42:01.934325
updated_at2021-02-06 11:59:14.793203
descriptionrust secure remote password authentication flow
homepage
repositoryhttps://github.com/MoeAl-Ani/rust-srp
max_upload_size
id348834
size32,933
(MoeAl-Ani)

documentation

README

SRP (secure remote password)

Implementation based on the RFC5054 specification. See also the SRP description at Wikipedia.

Only SHA-256 is currently supported, others are planned in the future.

Usage

Add the library to your cargo.toml:

[dependencies]
...
rust-srp = "0.1.8"
...

Routines

High-level description of the client-server interaction. An example can also be found from the test case test_srp_client_server.

Client routine

let n = <bigint>;
let g = <bigint>;
// Create the client
let mut client = SrpClient::new(n.clone(), g.clone());
// Create public key (A, bigint)
let a = client.step_1(<username>.clone(), <password>.clone());
// Create a client evidence (M1, bigint)
let m_1 = client.step_2(<salt>.clone(), b.clone());
// Validate server evidence (M2, bigint).
// Note: At this point the client is no longer usable, as it has passed its ownership to the function.
client.step_3(m_2)

Server routine

let n = <bigint>;
let g = <bigint>;
// Create server with the public client key A
let mut server = SrpServer::new(a, n.clone(), g.clone());
// Create public key B by locating the SRP params for user identity I
let b = server.step_1(<username>.clone(), <salt>.clone(), <verifier>.clone());
// Validate client evidence M1, and create server evidence M2.
// Note: At this point the server is no longer valid, as it has passed its ownership to the function.
let m_2 = server.step_2(m_1);
// If M1 is valid, then from the server's point of view, client is now authenticated
Commit count: 31

cargo fmt