Struct scram::ClientFirst
[−]
[src]
pub struct ClientFirst<'a> { // some fields omitted }
The initial state of the SCRAM mechanism. It's the entry point for a SCRAM handshake.
Methods
impl<'a> ClientFirst<'a>
[src]
fn new(authcid: &'a str, password: &'a str, authzid: Option<&'a str>) -> Result<Self>
Constructs an initial state for the SCRAM mechanism using the provided credentials.
Arguments
- authcid - An username used for authentication.
- password - A password used to prove that the user is authentic.
- authzid - An username used for authorization. This can be used to impersonate as
authzid
using the credentials ofauthcid
. Ifauthzid
isNone
the authorized username will be the same as the authenticated username.
Return value
An I/O error is returned if the internal random number generator couldn't be constructed.
fn with_rng<R: Rng>(authcid: &'a str, password: &'a str, authzid: Option<&'a str>, rng: R) -> Self
Constructs an initial state for the SCRAM mechanism using the provided credentials and a custom random number generator.
Arguments
- authcid - An username used for authentication.
- password - A password used to prove that the user is authentic.
- authzid - An username used for authorization. This can be used to impersonate as
authzid
using the credentials ofauthcid
. Ifauthzid
isNone
the authorized username will be the same as the authenticated username. - rng: A random number generator used to generate random nonces. Please only use a cryptographically secure random number generator!
fn client_first(self) -> (ServerFirst<'a>, String)
Returns the next state and the first client message.
Call the
ServerFirst::handle_server_first
method to continue the SCRAM handshake.