53 G_EXCEPTION( BadType ,
"invalid secret type" ) ;
54 G_EXCEPTION( Mismatch ,
"mismatched hash types" ) ;
55 G_EXCEPTION( NoState ,
"no intermediate-state hash function available" ) ;
56 G_EXCEPTION( InvalidState ,
"invalid hash function intermediate state" ) ;
58 static std::string
response(
const std::string & hash_type ,
bool hmac ,
60 const std::string & response_prefix ) ;
66 static std::string
id(
const std::string &
response ) ;
70 static bool validate(
const std::string & hash_type ,
bool hmac ,
83 static std::string
challenge(
unsigned int random ) ;
91 static std::string responseImp(
const std::string & ,
bool ,
const Secret & ,
const std::string & ) ;
Implements the standard challenge-response authentication mechanism of RFC-2195.
static std::string challenge(unsigned int random)
Returns a challenge string that incorporates the given random number and the current time.
static std::string id(const std::string &response)
Returns the leading id part of the response.
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 sec...
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.
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.
Encapsulates a shared secret from the secrets file plus the associated userid.
SASL authentication classes.
std::vector< std::string > StringArray
A std::vector of std::strings.