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") )
60 static std::string
response( std::string_view hash_type ,
bool hmac ,
62 std::string_view response_prefix ) ;
68 static std::string
id( std::string_view
response ) ;
72 static bool validate( std::string_view hash_type ,
bool hmac ,
85 static std::string
challenge(
unsigned int random ,
const std::string & challenge_domain ) ;
93 static std::string responseImp( std::string_view ,
bool ,
const Secret & , std::string_view ) ;
Implements the standard challenge-response authentication mechanism of RFC-2195.
static std::string id(std::string_view response)
Returns the leading id part of the response.
static G::StringArray hashTypes(std::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 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 bool validate(std::string_view hash_type, bool hmac, const Secret &secret, std::string_view challenge, std::string_view response)
Validates the response with respect to the original challenge.
static std::string response(std::string_view hash_type, bool hmac, const Secret &secret, std::string_view challenge, std::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.
SASL authentication classes.
std::vector< std::string > StringArray
A std::vector of std::strings.
constexpr const char * tx(const char *p) noexcept
A briefer alternative to G::gettext_noop().