54 G_EXCEPTION( BadType ,
tx(
"invalid secret type") ) ;
55 G_EXCEPTION( Mismatch ,
tx(
"mismatched hash types") ) ;
56 G_EXCEPTION( NoState ,
tx(
"no intermediate-state hash function available") ) ;
57 G_EXCEPTION( InvalidState ,
tx(
"invalid hash function intermediate state") ) ;
58 G_EXCEPTION( NoTls ,
tx(
"no tls library") ) ;
85 static std::string
challenge(
unsigned int random ,
const std::string & challenge_domain ) ;
Implements the standard challenge-response authentication mechanism of RFC-2195.
static G::StringArray hashTypes(G::string_view prefix={}, bool require_state=false)
Returns a list of supported hash types, such as "MD5" and "SHA1", ordered with the strongest first.
static bool validate(G::string_view hash_type, bool hmac, const Secret &secret, G::string_view challenge, G::string_view response)
Validates the response with respect to the original challenge.
static std::string challenge(unsigned int random, const std::string &challenge_domain)
Returns a challenge string that incorporates the given random number and the current time.
static std::string id(G::string_view response)
Returns the leading id part of the response.
static std::string response(G::string_view hash_type, bool hmac, const Secret &secret, G::string_view challenge, G::string_view response_prefix)
Constructs a response to a challenge comprising the response-prefix, space, and digest-or-hmac of sec...
Encapsulates a userid/shared-secret/hash-function tuple from the secrets file.
A class like c++17's std::string_view.
SASL authentication classes.
std::vector< std::string > StringArray
A std::vector of std::strings.
constexpr const char * tx(const char *p)
A briefer alternative to G::gettext_noop().