Crates.io | scram-rs |
lib.rs | scram-rs |
version | 0.11.0 |
source | src |
created_at | 2021-03-27 00:31:52.7745 |
updated_at | 2024-02-13 21:45:19.416939 |
description | Salted Challenge Response Authentication Mechanism (SCRAM) SASL mechanism, a library which implements SCRAM logic |
homepage | |
repository | https://repo.4neko.org/4NEKO/scram-rs |
max_upload_size | |
id | 374018 |
size | 262,900 |
v 0.11
A SCRAM-SHA1, SCRAM-SHA256, SCRAM-SHA512, SCRAM-SHA256-PLUS client and server.
MPL-2.0
server-error
RFC5802 (e=server-error-value
)This crate does not open a remote connection to host for you. It does not contain a code to open a connection to any remote target. This crate contains only a SCRAM-SHA logic. Your program manages the connection itself, reception of the data itself and transmitting it back to client/server on its own. This crated performs only logical operaions on received data and retrns the result to your program. This appreoach inreases a flexibility. This crate also implements a signalling so there is no need to implement a special error handling.
By default the following crates: [pbkdf2], [hmac], [sha2], [sha1] are included with this crate and a trait objects are availeble.
use_ring
- adds crate: [ring] to the crate and a trait objects becomes available.Both features can not be used at the same time.
Author of this crate is not responsible for anything which may happen.
see ./examples/ there
iteration | use_default | use_ring |
---|---|---|
1 | 98.02ms | 16.96ms |
2 | 98.69ms | 16.52ms |
3 | 95.27ms | 16.04ms |
iteration | use_default | use_ring |
---|---|---|
1 | 97.66ms | 16.15ms |
2 | 100.65ms | 15.98ms |
3 | 100.05ms | 17.12ms |
Generic struct:
let authdb = AuthDB::new();
let scramtype = ScramCommon::get_scramtype("SCRAM-SHA-256").unwrap();
let mut server =
SyncScramServer::<ScramSha256RustNative, AuthDB, AuthDB>::new(&authdb, &authdb, ScramNonce::none(), scramtype).unwrap();
Dynamic:
let authdb = AuthDB::new();
let authdbcb = AuthDBCb{};
let scramtype = ScramCommon::get_scramtype("SCRAM-SHA-256").unwrap();
let server =
SyncScramServer
::<ScramSha256RustNative, AuthDB, AuthDBCb>
::new_variable(BorrowOrConsume::from(authdb), BorrowOrConsume::from(authdbcb), ScramNonce::none(), BorrowOrConsume::from(scramtype.clone())).unwrap();
let mut server_dyn = server.make_dyn();
Custom:
let authdb = AuthDB::new();
let conninst = ConnectionInst::new();
let scramtype = ScramCommon::get_scramtype("SCRAM-SHA-256").unwrap();
let mut server =
SyncScramServer
::<ScramSha256RustNative, AuthDB, ConnectionInst>
::new_variable(
BorrowOrConsume::from(authdb),
BorrowOrConsume::from(conninst),
ScramNonce::none(),
BorrowOrConsume::from(scramtype)
)
.unwrap();