![]() |
Kea 3.1.1
|
Managed GSS-TSIG key. More...
#include <managed_key.h>
Public Types | |
enum | Status { NOT_READY , USABLE , EXPIRED , IN_ERROR } |
A key status. More... | |
Public Member Functions | |
ManagedKey (const std::string &name) | |
Constructor. | |
virtual | ~ManagedKey ()=default |
Destructor. | |
virtual dns::TSIGContextPtr | createContext () |
Create GssTsigContext context. | |
std::string | getKeyNameStr () const |
Get the key name as a string. | |
std::string | getParentID () const |
Get the DNS server (parent) ID. | |
Status | getStatus () const |
Get the key status. | |
TKeyExchangePtr & | getTKeyExchange () |
Get the TKEY exchange. | |
TKeyExchange::Status | getTKeyStatus () const |
Get the TKEY exchange status. | |
void | operator() (TKeyExchange::Status tkey_status) |
The TKEY exchange completion handler. | |
void | setParentID (const std::string &parent_id) |
Set the DNS server (parent) ID. | |
void | setStatus (Status status) |
Set the key status. | |
void | setTKeyStatus (TKeyExchange::Status tkey_status) |
Set the TKEY exchange status. | |
isc::data::ElementPtr | toElement () const |
Unparse a key object. | |
![]() | |
GssTsigKey (const std::string &key_name, const std::vector< uint8_t > &import) | |
Constructor. | |
GssTsigKey (const std::string &key_name, gss_ctx_id_t sec_ctx=GSS_C_NO_CONTEXT) | |
Constructor. | |
virtual | ~GssTsigKey () |
Destructor. | |
std::chrono::system_clock::time_point | getExpire () const |
Get the key expire. | |
uint32_t | getExpire32 () const |
Get the key expire (32 bits). | |
std::chrono::system_clock::time_point | getInception () const |
Get the key inception. | |
uint32_t | getInception32 () const |
Get the key inception (32 bits). | |
GssApiSecCtx & | getSecCtx () |
Get the security context. | |
void | setExpire (const std::chrono::system_clock::time_point &expire) |
Set the key expire. | |
void | setInception (const std::chrono::system_clock::time_point &inception) |
Set the key inception. | |
![]() | |
D2TsigKey (const dns::Name &key_name, const dns::Name &algorithm_name, const void *secret, size_t secret_len, size_t digestbits=0) | |
Constructor. | |
D2TsigKey (const std::string &key_spec) | |
Constructor. | |
virtual | ~D2TsigKey () |
Destructor. | |
virtual void | resetStats () |
Reset statistics. | |
![]() | |
TSIGKey (const Name &key_name, const Name &algorithm_name, const void *secret, size_t secret_len, size_t digestbits=0) | |
Constructors, Assignment Operator and Destructor. | |
TSIGKey (const std::string &str) | |
Constructor from an input string. | |
TSIGKey (const TSIGKey &source) | |
The copy constructor. | |
virtual | ~TSIGKey () |
The destructor. | |
isc::cryptolink::HashAlgorithm | getAlgorithm () const |
Return the hash algorithm name in the form of cryptolink::HashAlgorithm. | |
const Name & | getAlgorithmName () const |
Return the algorithm name. | |
size_t | getDigestbits () const |
Return the minimum truncated length. | |
const Name & | getKeyName () const |
Getter Methods. | |
const void * | getSecret () const |
Return the value of the TSIG secret. | |
size_t | getSecretLength () const |
Return the length of the TSIG secret in bytes. | |
TSIGKey & | operator= (const TSIGKey &source) |
Assignment operator. | |
std::string | toText () const |
Converts the TSIGKey to a string value. | |
![]() | |
virtual | ~Callback () |
Virtual destructor. | |
![]() | |
virtual | ~CfgToElement () |
Destructor. | |
Static Public Member Functions | |
static std::string | genName (const std::string &server) |
Create a random name from a suffix. | |
static std::string | statusToText (Status status) |
Convert a status to its textual form. | |
![]() | |
static const Name & | GSSTSIG_NAME () |
static const Name & | HMACMD5_NAME () |
Well known algorithm names as defined in RFC2845 and RFC4635. | |
static const Name & | HMACMD5_SHORT_NAME () |
static const Name & | HMACSHA1_NAME () |
static const Name & | HMACSHA224_NAME () |
static const Name & | HMACSHA256_NAME () |
static const Name & | HMACSHA384_NAME () |
static const Name & | HMACSHA512_NAME () |
Public Attributes | |
boost::scoped_ptr< std::mutex > | mutex_ |
Mutex for protecting key state. | |
Additional Inherited Members | |
![]() | |
std::chrono::system_clock::time_point | expire_ |
The key expire date. | |
std::chrono::system_clock::time_point | inception_ |
The key inception date. | |
std::unique_ptr< GssApiSecCtx > | sec_ctx_ |
GSS-API security context. | |
Managed GSS-TSIG key.
This class extends GssTsigKey
with data which are defined in headers which include the class definition.
Definition at line 23 of file managed_key.h.
A key status.
Standard flow is initialized as not ready, after the setup usable and at expire finishes as expired. When the setup fails it is in error, the TKEY exchange status giving more details on the failure reason.
Enumerator | |
---|---|
NOT_READY | Not yet ready (not yet usable). |
USABLE | Usable. |
EXPIRED | Expired (no longer usable). |
IN_ERROR | Setup failed. |
Definition at line 32 of file managed_key.h.
isc::gss_tsig::ManagedKey::ManagedKey | ( | const std::string & | name | ) |
Constructor.
name | Key name. |
Definition at line 50 of file managed_key.cc.
References isc::gss_tsig::GssTsigKey::GssTsigKey(), mutex_, and NOT_READY.
|
virtualdefault |
Destructor.
|
virtual |
Create GssTsigContext context.
isc::d2::D2TsigKey
method.Reimplemented from isc::d2::D2TsigKey.
Definition at line 131 of file managed_key.cc.
|
static |
Create a random name from a suffix.
server | The server suffix. |
Definition at line 41 of file managed_key.cc.
References isc::cryptolink::random().
Referenced by isc::gss_tsig::GssTsigImpl::createKey().
|
inline |
Get the key name as a string.
Definition at line 53 of file managed_key.h.
References isc::dns::TSIGKey::getKeyName(), and isc::dns::TSIGKey::toText().
Referenced by toElement().
|
inline |
Get the DNS server (parent) ID.
Definition at line 60 of file managed_key.h.
Referenced by toElement().
|
inline |
|
inline |
Get the TKEY exchange.
Definition at line 102 of file managed_key.h.
Referenced by operator()().
|
inline |
Get the TKEY exchange status.
Definition at line 88 of file managed_key.h.
|
virtual |
The TKEY exchange completion handler.
tkey_status | The completion status. |
Implements isc::gss_tsig::TKeyExchange::Callback.
Definition at line 56 of file managed_key.cc.
References isc::log::DBGLVL_TRACE_BASIC, isc::dns::TSIGKey::getKeyName(), getTKeyExchange(), isc::gss_tsig::gss_tsig_logger, isc::gss_tsig::GSS_TSIG_NEW_KEY_SETUP_FAILED, isc::gss_tsig::GSS_TSIG_NEW_KEY_SETUP_SUCCEED, IN_ERROR, LOG_DEBUG, LOG_WARN, mutex_, setStatus(), setTKeyStatus(), isc::gss_tsig::TKeyExchange::statusToText(), isc::gss_tsig::TKeyExchange::SUCCESS, isc::dns::TSIGKey::toText(), and USABLE.
|
inline |
Set the DNS server (parent) ID.
parent_id | DNS server (parent) ID. |
Definition at line 67 of file managed_key.h.
|
inline |
Set the key status.
status | The new key status. |
Definition at line 81 of file managed_key.h.
Referenced by operator()().
|
inline |
Set the TKEY exchange status.
tkey_status | The new TKEY exchange status. |
Definition at line 95 of file managed_key.h.
Referenced by operator()().
Convert a status to its textual form.
Definition at line 27 of file managed_key.cc.
References EXPIRED, NOT_READY, and USABLE.
Referenced by toElement().
|
virtual |
Unparse a key object.
Used to get the full state of a key:
Implements isc::data::CfgToElement.
Definition at line 83 of file managed_key.cc.
References isc::util::clockToText(), Element::create(), Element::createMap(), isc::gss_tsig::GssTsigKey::expire_, EXPIRED, getKeyNameStr(), getParentID(), IN_ERROR, isc::gss_tsig::GssTsigKey::inception_, isc::gss_tsig::GssTsigKey::sec_ctx_, statusToText(), isc::gss_tsig::TKeyExchange::statusToText(), and USABLE.
boost::scoped_ptr<std::mutex> isc::gss_tsig::ManagedKey::mutex_ |
Mutex for protecting key state.
Definition at line 152 of file managed_key.h.
Referenced by ManagedKey(), and operator()().