Struct wow_srp::client::SrpClientChallenge
source · pub struct SrpClientChallenge { /* private fields */ }
srp-default-math
or srp-fast-math
only.Expand description
First step of the client connection. Next is SrpClient
.
The client proof and public key must be sent to the server in the
CMD_AUTH_LOGON_PROOF_Client
packet before the server proof is available.
All arrays are little endian.
The CRC check also present in the same network packet is out of scope for this crate.
Implementations§
source§impl SrpClientChallenge
impl SrpClientChallenge
sourcepub fn new(
username: NormalizedString,
password: NormalizedString,
generator: u8,
large_safe_prime: [u8; 32],
server_public_key: PublicKey,
salt: [u8; 32]
) -> SrpClientChallenge
pub fn new( username: NormalizedString, password: NormalizedString, generator: u8, large_safe_prime: [u8; 32], server_public_key: PublicKey, salt: [u8; 32] ) -> SrpClientChallenge
Takes the server supplied variables and computes the next step.
The generator and large safe prime are not checked for validity.
All arrays are little endian.
§Panics
Panics on the extremely unlikely chance that the generated public key is invalid.
See PublicKey
for details on validity.
There are only two invalid states for the randomly generated server public key:
- All zeros.
- Exactly the same as the large safe prime.
This is 2 out of 2^256
possible states. The chances of this occurring naturally are very slim.
It is significantly more likely that the RNG of the system has been compromised in which case
authentication is not possible.
sourcepub const fn client_proof(&self) -> &[u8; 20]
pub const fn client_proof(&self) -> &[u8; 20]
Called M
in RFC2945, called M1
in other literature.
M2
is the argument passed to SrpClientChallenge::verify_server_proof
.
sourcepub const fn client_public_key(&self) -> &[u8; 32]
pub const fn client_public_key(&self) -> &[u8; 32]
Called A
in RFC2945.
Also sometimes referred to as a
, although this is the abbreviation of the private key.
If the lowercase version appears in a packet table it is referring to the public key.
sourcepub fn verify_server_proof(
self,
server_proof: [u8; 20]
) -> Result<SrpClient, MatchProofsError>
pub fn verify_server_proof( self, server_proof: [u8; 20] ) -> Result<SrpClient, MatchProofsError>
Verifies that the server knows the same password as was initially used in SrpClientChallenge::new
.
§Errors
This should very rarely return an error unless something weird is going on with the server, ther server deliberately sends an incorrect value, or the packet has been read incorrectly.
Trait Implementations§
source§impl Clone for SrpClientChallenge
impl Clone for SrpClientChallenge
source§fn clone(&self) -> SrpClientChallenge
fn clone(&self) -> SrpClientChallenge
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SrpClientChallenge
impl Debug for SrpClientChallenge
source§impl Hash for SrpClientChallenge
impl Hash for SrpClientChallenge
source§impl Ord for SrpClientChallenge
impl Ord for SrpClientChallenge
source§fn cmp(&self, other: &SrpClientChallenge) -> Ordering
fn cmp(&self, other: &SrpClientChallenge) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for SrpClientChallenge
impl PartialEq for SrpClientChallenge
source§fn eq(&self, other: &SrpClientChallenge) -> bool
fn eq(&self, other: &SrpClientChallenge) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for SrpClientChallenge
impl PartialOrd for SrpClientChallenge
source§fn partial_cmp(&self, other: &SrpClientChallenge) -> Option<Ordering>
fn partial_cmp(&self, other: &SrpClientChallenge) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more