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

Encapsulates a shared secret from the secrets file plus the associated userid. More...

#include <gsecret.h>

Public Member Functions

 Secret (const std::string &, const std::string &, const std::string &, const std::string &=std::string())
 Constructor used by the SecretsFile class.
 
bool valid () const
 Returns true if the secret is valid.
 
std::string key () const
 Returns the key. Throws if not valid().
 
bool masked () const
 Returns true if key() is masked.
 
std::string maskType () const
 Returns the masking function name, such as "MD5", or the empty string if not masked(). More...
 
std::string id () const
 Returns the associated identity. Throws if not valid().
 
std::string info (const std::string &id=std::string()) const
 Returns information for logging, excluding anything sensitive. More...
 

Static Public Member Functions

static std::string check (const std::string &, const std::string &, const std::string &)
 Does a non-throwing check of the constructor parameters, returning an error or the empty string. More...
 
static Secret none (const std::string &id)
 Factory function that returns a secret that is not valid(), as used by the SecretsFile class. More...
 
static Secret none ()
 Factory function that returns a secret that is not valid() and has an empty id(). More...
 

Detailed Description

Encapsulates a shared secret from the secrets file plus the associated userid.

A secret is usually a shared key, but it may be masked by a hash function. If masked then it can only be verified by an hmac operation using the matching hash function. However, the hmac hash function must be capable of accepting an intermediate hash state, and this is might only be available for md5.

Definition at line 42 of file gsecret.h.

Member Function Documentation

std::string GAuth::Secret::check ( const std::string &  secret,
const std::string &  type,
const std::string &  id 
)
static

Does a non-throwing check of the constructor parameters, returning an error or the empty string.

Definition at line 68 of file gsecret.cpp.

std::string GAuth::Secret::info ( const std::string &  id = std::string()) const

Returns information for logging, excluding anything sensitive.

The secret may be in-valid().

Definition at line 123 of file gsecret.cpp.

std::string GAuth::Secret::maskType ( ) const

Returns the masking function name, such as "MD5", or the empty string if not masked().

Throws if not valid().

Definition at line 117 of file gsecret.cpp.

GAuth::Secret GAuth::Secret::none ( const std::string &  id)
static

Factory function that returns a secret that is not valid(), as used by the SecretsFile class.

Definition at line 85 of file gsecret.cpp.

GAuth::Secret GAuth::Secret::none ( )
static

Factory function that returns a secret that is not valid() and has an empty id().

Definition at line 90 of file gsecret.cpp.


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