MySQL 8.0.39
Source Code Documentation
sha2_password::Validate_scramble Class Reference

Scramble validator Expects scramble to be: XOR(SHA2(m_src), SHA2(SHA2(SHA2(m_src)), m_rnd)) Validates it against: SHA2(SHA2(m_src)) and random string. More...

#include <i_sha2_password_common.h>

Public Member Functions

 Validate_scramble (const unsigned char *scramble, const unsigned char *known, const unsigned char *rnd, unsigned int rnd_length, Digest_info digest_type=Digest_info::SHA256_DIGEST)
 Validate scramble constructor. More...
 
 ~Validate_scramble ()
 Validate_scramble destructor. More...
 
bool validate ()
 Validate the scramble. More...
 

Private Attributes

const unsigned char * m_scramble
 scramble to be validated More...
 
const unsigned char * m_known
 SHA2(SHA2(plaintext_password)) More...
 
const unsigned char * m_rnd
 random string More...
 
unsigned int m_rnd_length
 random string length More...
 
Digest_info m_digest_type
 Type of digest. More...
 
Generate_digestm_digest_generator
 Digest generator class. More...
 
unsigned int m_digest_length
 length of the digest More...
 

Detailed Description

Scramble validator Expects scramble to be: XOR(SHA2(m_src), SHA2(SHA2(SHA2(m_src)), m_rnd)) Validates it against: SHA2(SHA2(m_src)) and random string.

See also
Generate_scramble
SHA256_digest
Digest_info

Constructor & Destructor Documentation

◆ Validate_scramble()

sha2_password::Validate_scramble::Validate_scramble ( const unsigned char *  scramble,
const unsigned char *  known,
const unsigned char *  rnd,
unsigned int  rnd_length,
Digest_info  digest_type = Digest_info::SHA256_DIGEST 
)

Validate scramble constructor.

Parameters
[in]scrambleScramble to be validated
[in]knownKnown digest against which scramble is to be verified
[in]rndSalt
[in]rnd_lengthLength of the salt buffer
[in]digest_typeType od digest

◆ ~Validate_scramble()

sha2_password::Validate_scramble::~Validate_scramble ( )

Validate_scramble destructor.

Member Function Documentation

◆ validate()

bool sha2_password::Validate_scramble::validate ( )

Validate the scramble.

Note
SHA2(known, rnd) => scramble_stage1 XOR(scramble, scramble_stage1) => digest_stage1 SHA2(digest_stage1) => digest_stage2 m_known == digest_stage2
Returns
Result of validation process
Return values
falseSuccessful validation
trueError

Member Data Documentation

◆ m_digest_generator

Generate_digest* sha2_password::Validate_scramble::m_digest_generator
private

Digest generator class.

◆ m_digest_length

unsigned int sha2_password::Validate_scramble::m_digest_length
private

length of the digest

◆ m_digest_type

Digest_info sha2_password::Validate_scramble::m_digest_type
private

Type of digest.

◆ m_known

const unsigned char* sha2_password::Validate_scramble::m_known
private

SHA2(SHA2(plaintext_password))

◆ m_rnd

const unsigned char* sha2_password::Validate_scramble::m_rnd
private

random string

◆ m_rnd_length

unsigned int sha2_password::Validate_scramble::m_rnd_length
private

random string length

◆ m_scramble

const unsigned char* sha2_password::Validate_scramble::m_scramble
private

scramble to be validated


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