21 #ifndef G_AUTH_CRAM__H
22 #define G_AUTH_CRAM__H
42 G_EXCEPTION( BadType ,
"invalid secret type" ) ;
43 G_EXCEPTION( Mismatch ,
"mismatched hash types" ) ;
44 G_EXCEPTION( NoState ,
"no implementation for extracting hash function state" ) ;
46 static std::string
response(
const std::string & hash_type ,
bool hmac ,
48 const std::string & response_prefix ) ;
54 static std::string
id(
const std::string & response ) ;
58 static bool validate(
const std::string & hash_type ,
bool hmac ,
59 const Secret & secret ,
const std::string & challenge ,
60 const std::string & response ) ;
76 static std::string responseImp(
const std::string & ,
bool ,
const Secret & ,
const std::string & ) ;
std::vector< std::string > StringArray
A std::vector of std::strings.
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 std::string challenge()
Returns a challenge string that incorporates a 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 key...
Implements the standard challenge-response authentication mechanism of RFC-2195.
SASL authentication classes.
Encapsulates a shared secret from the secrets file plus the associated userid.
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...