E-MailRelay
Static Public Member Functions | List of all members
GAuth::Cram Class Reference

Implements the standard challenge-response authentication mechanism of RFC-2195. More...

#include <gcram.h>

Static Public Member Functions

static std::string response (const std::string &hash_type, bool hmac, const Secret &secret, const std::string &challenge, const std::string &response_prefix)
 Constructs a response to a challenge comprising the response-prefix, space, and digest-or-hmac of key-plus-challenge. More...
 
static std::string id (const std::string &response)
 Returns the leading id part of the response. More...
 
static bool validate (const std::string &hash_type, bool hmac, const Secret &secret, const std::string &challenge, const std::string &response)
 Validates the response with respect to the original challenge. More...
 
static G::StringArray hashTypes (const std::string &prefix=std::string(), bool require_state=false)
 Returns a list of supported hash types, such as "MD5" and "SHA1", ordered with the strongest first. More...
 
static std::string challenge ()
 Returns a challenge string that incorporates a random number and the current time. More...
 

Detailed Description

Implements the standard challenge-response authentication mechanism of RFC-2195.

Definition at line 39 of file gcram.h.

Member Function Documentation

std::string GAuth::Cram::challenge ( )
static

Returns a challenge string that incorporates a random number and the current time.

Definition at line 208 of file gcram.cpp.

G::StringArray GAuth::Cram::hashTypes ( const std::string &  prefix = std::string(),
bool  require_state = false 
)
static

Returns a list of supported hash types, such as "MD5" and "SHA1", ordered with the strongest first.

Optionally adds a prefix to each type, and optionally limits the list to those hash functions that support initialisation with intermediate state.

Definition at line 183 of file gcram.cpp.

std::string GAuth::Cram::id ( const std::string &  response)
static

Returns the leading id part of the response.

Returns the empty string on error.

Definition at line 130 of file gcram.cpp.

std::string GAuth::Cram::response ( const std::string &  hash_type,
bool  hmac,
const Secret &  secret,
const std::string &  challenge,
const std::string &  response_prefix 
)
static

Constructs a response to a challenge comprising the response-prefix, space, and digest-or-hmac of key-plus-challenge.

Returns an empty string on error; does not throw.

Definition at line 90 of file gcram.cpp.

bool GAuth::Cram::validate ( const std::string &  hash_type,
bool  hmac,
const Secret &  secret,
const std::string &  challenge,
const std::string &  response 
)
static

Validates the response with respect to the original challenge.

Returns false on error; does not throw.

Definition at line 110 of file gcram.cpp.


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