TrinityCore
Loading...
Searching...
No Matches
Trinity::Crypto::SRP6 Class Reference

#include <SRP6.h>

Public Types

using Salt = std::array< uint8, SALT_LENGTH >
 
using Verifier = std::array< uint8, VERIFIER_LENGTH >
 
using EphemeralKey = std::array< uint8, EPHEMERAL_KEY_LENGTH >
 

Public Member Functions

 SRP6 (std::string const &username, Salt const &salt, Verifier const &verifier)
 
std::optional< SessionKey > VerifyChallengeResponse (EphemeralKey const &A, SHA1::Digest const &clientM)
 

Static Public Member Functions

static std::pair< Salt, Verifier > MakeRegistrationData (std::string const &username, std::string const &password)
 
static bool CheckLogin (std::string const &username, std::string const &password, Salt const &salt, Verifier const &verifier)
 
static SHA1::Digest GetSessionVerifier (EphemeralKey const &A, SHA1::Digest const &clientM, SessionKey const &K)
 

Public Attributes

Salt const s
 
EphemeralKey const B
 

Static Public Attributes

static constexpr size_t SALT_LENGTH = 32
 
static constexpr size_t VERIFIER_LENGTH = 32
 
static constexpr size_t EPHEMERAL_KEY_LENGTH = 32
 
static std::array< uint8, 1 > const g = { 7 }
 
static std::array< uint8, 32 > const N = HexStrToByteArray<32>("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7", true)
 

Static Private Member Functions

static Verifier CalculateVerifier (std::string const &username, std::string const &password, Salt const &salt)
 
static SessionKey SHA1Interleave (EphemeralKey const &S)
 
static EphemeralKey _B (BigNumber const &b, BigNumber const &v)
 

Private Attributes

bool _used = false
 
SHA1::Digest const _I
 
BigNumber const _b
 
BigNumber const _v
 

Static Private Attributes

static BigNumber const _g
 
static BigNumber const _N
 

Detailed Description

Definition at line 31 of file SRP6.h.

Member Typedef Documentation

◆ EphemeralKey

Definition at line 39 of file SRP6.h.

◆ Salt

Definition at line 35 of file SRP6.h.

◆ Verifier

Definition at line 37 of file SRP6.h.

Constructor & Destructor Documentation

◆ SRP6()

SRP6::SRP6 ( std::string const &  username,
Salt const &  salt,
Verifier const &  verifier 
)

Definition at line 81 of file SRP6.cpp.

Member Function Documentation

◆ _B()

static EphemeralKey Trinity::Crypto::SRP6::_B ( BigNumber const &  b,
BigNumber const &  v 
)
inlinestaticprivate

Definition at line 70 of file SRP6.h.

References BigNumber::ModExp().

◆ CalculateVerifier()

SRP6::Verifier SRP6::CalculateVerifier ( std::string const &  username,
std::string const &  password,
SRP6::Salt const &  salt 
)
staticprivate

◆ CheckLogin()

static bool Trinity::Crypto::SRP6::CheckLogin ( std::string const &  username,
std::string const &  password,
Salt const &  salt,
Verifier const &  verifier 
)
inlinestatic

Definition at line 47 of file SRP6.h.

Referenced by RASession::CheckPassword(), and AccountMgr::CheckPassword().

◆ GetSessionVerifier()

static SHA1::Digest Trinity::Crypto::SRP6::GetSessionVerifier ( EphemeralKey const &  A,
SHA1::Digest const &  clientM,
SessionKey const &  K 
)
inlinestatic

◆ MakeRegistrationData()

std::pair< SRP6::Salt, SRP6::Verifier > SRP6::MakeRegistrationData ( std::string const &  username,
std::string const &  password 
)
static

◆ SHA1Interleave()

◆ VerifyChallengeResponse()

std::optional< SessionKey > SRP6::VerifyChallengeResponse ( EphemeralKey const &  A,
SHA1::Digest const &  clientM 
)

Member Data Documentation

◆ _b

BigNumber const Trinity::Crypto::SRP6::_b
private

Definition at line 74 of file SRP6.h.

Referenced by VerifyChallengeResponse().

◆ _g

BigNumber const SRP6::_g
staticprivate

Definition at line 67 of file SRP6.h.

Referenced by CalculateVerifier().

◆ _I

SHA1::Digest const Trinity::Crypto::SRP6::_I
private

Definition at line 73 of file SRP6.h.

Referenced by VerifyChallengeResponse().

◆ _N

BigNumber const SRP6::_N
staticprivate

Definition at line 68 of file SRP6.h.

Referenced by CalculateVerifier(), and VerifyChallengeResponse().

◆ _used

bool Trinity::Crypto::SRP6::_used = false
private

Definition at line 61 of file SRP6.h.

Referenced by VerifyChallengeResponse().

◆ _v

BigNumber const Trinity::Crypto::SRP6::_v
private

Definition at line 75 of file SRP6.h.

Referenced by VerifyChallengeResponse().

◆ B

EphemeralKey const Trinity::Crypto::SRP6::B

Definition at line 79 of file SRP6.h.

Referenced by VerifyChallengeResponse().

◆ EPHEMERAL_KEY_LENGTH

constexpr size_t Trinity::Crypto::SRP6::EPHEMERAL_KEY_LENGTH = 32
staticconstexpr

Definition at line 38 of file SRP6.h.

Referenced by SHA1Interleave().

◆ g

std::array< uint8, 1 > const SRP6::g = { 7 }
static

Definition at line 41 of file SRP6.h.

Referenced by VerifyChallengeResponse().

◆ N

std::array< uint8, 32 > const SRP6::N = HexStrToByteArray<32>("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7", true)
static

Definition at line 42 of file SRP6.h.

Referenced by VerifyChallengeResponse().

◆ s

Salt const Trinity::Crypto::SRP6::s

Definition at line 78 of file SRP6.h.

Referenced by VerifyChallengeResponse().

◆ SALT_LENGTH

constexpr size_t Trinity::Crypto::SRP6::SALT_LENGTH = 32
staticconstexpr

◆ VERIFIER_LENGTH

constexpr size_t Trinity::Crypto::SRP6::VERIFIER_LENGTH = 32
staticconstexpr

The documentation for this class was generated from the following files: