Crates.io | rust_srp |
lib.rs | rust_srp |
version | 0.1.8 |
source | src |
created_at | 2021-01-31 11:42:01.934325 |
updated_at | 2021-02-06 11:59:14.793203 |
description | rust secure remote password authentication flow |
homepage | |
repository | https://github.com/MoeAl-Ani/rust-srp |
max_upload_size | |
id | 348834 |
size | 32,933 |
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.
Add the library to your cargo.toml
:
[dependencies]
...
rust-srp = "0.1.8"
...
High-level description of the client-server interaction. An example can also be found from the test case test_srp_client_server.
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)
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