Kea  2.3.5-git
isc::d2::TSIGKeyInfo Class Reference

Represents a TSIG Key. More...

#include <d2_config.h>

+ Inheritance diagram for isc::d2::TSIGKeyInfo:

Public Member Functions

 TSIGKeyInfo (const std::string &name, const std::string &algorithm, const std::string &secret, uint32_t digestbits=0)
 Constructor. More...
 
virtual ~TSIGKeyInfo ()
 Destructor. More...
 
const std::string getAlgorithm () const
 Getter which returns the key's algorithm string ID. More...
 
uint32_t getDigestbits () const
 Getter which returns the key's minimum truncated length. More...
 
const std::string getName () const
 Getter which returns the key's name. More...
 
const std::string getSecret () const
 Getter which returns the key's secret. More...
 
const D2TsigKeyPtrgetTSIGKey () const
 Getter which returns the TSIG key used to sign and verify messages. More...
 
virtual isc::data::ElementPtr toElement () const
 Unparse a configuration object. More...
 
- Public Member Functions inherited from isc::data::UserContext
void contextToElement (data::ElementPtr map) const
 Merge unparse a user_context object. More...
 
data::ConstElementPtr getContext () const
 Returns const pointer to the user context. More...
 
void setContext (const data::ConstElementPtr &ctx)
 Sets user context. More...
 
- Public Member Functions inherited from isc::data::CfgToElement
virtual ~CfgToElement ()
 Destructor. More...
 

Static Public Member Functions

static const dns::NamestringToAlgorithmName (const std::string &algorithm_id)
 Converts algorithm id to dns::TSIGKey algorithm dns::Name. More...
 
- Static Public Member Functions inherited from isc::data::UserContext
static data::ElementPtr toElement (data::ConstElementPtr map)
 Copy an Element map. More...
 

Static Public Attributes

static const char * HMAC_MD5_STR = "HMAC-MD5"
 Defines string values for the supported TSIG algorithms. More...
 
static const char * HMAC_SHA1_STR = "HMAC-SHA1"
 
static const char * HMAC_SHA256_STR = "HMAC-SHA256"
 
static const char * HMAC_SHA224_STR = "HMAC-SHA224"
 
static const char * HMAC_SHA384_STR = "HMAC-SHA384"
 
static const char * HMAC_SHA512_STR = "HMAC-SHA512"
 

Additional Inherited Members

- Protected Attributes inherited from isc::data::UserContext
data::ConstElementPtr user_context_
 Pointer to the user context (may be NULL) More...
 

Detailed Description

Represents a TSIG Key.

Acts as both a storage class containing the basic attributes which describe a TSIG Key, as well as owning and providing access to an instance of the actual key (isc::dns::TSIGKey) that can be used by the IO layer for signing and verifying messages.

Definition at line 266 of file d2_config.h.

Constructor & Destructor Documentation

◆ TSIGKeyInfo()

isc::d2::TSIGKeyInfo::TSIGKeyInfo ( const std::string &  name,
const std::string &  algorithm,
const std::string &  secret,
uint32_t  digestbits = 0 
)

Constructor.

Parameters
namethe unique label used to identify this key
algorithmthe id of the encryption algorithm this key uses. Currently supported values are (case insensitive):
  1. "HMAC-MD5"
  2. "HMAC-SHA1"
  3. "HMAC-SHA224"
  4. "HMAC-SHA256"
  5. "HMAC-SHA384"
  6. "HMAC-SHA512"
secretThe base-64 encoded secret component for this key. (A suitable string for use here could be obtained by running the BIND 9 dnssec-keygen program; the contents of resulting key file will look similar to:
Private-key-format: v1.3
Algorithm: 157 (HMAC_MD5)
Key: LSWXnfkKZjdPJI5QxlpnfQ==
Bits: AAA=
Created: 20140515143700
Publish: 20140515143700
Activate: 20140515143700
where the value the "Key:" entry is the secret component of the key.)
digestbitsthe minimum truncated length in bits
Exceptions
D2CfgErrorif values supplied are invalid: name cannot be blank, algorithm must be a supported value, secret must be a non-blank, base64 encoded string.

Definition at line 135 of file d2_config.cc.

◆ ~TSIGKeyInfo()

isc::d2::TSIGKeyInfo::~TSIGKeyInfo ( )
virtual

Destructor.

Definition at line 142 of file d2_config.cc.

Member Function Documentation

◆ getAlgorithm()

const std::string isc::d2::TSIGKeyInfo::getAlgorithm ( ) const
inline

Getter which returns the key's algorithm string ID.

Returns
returns the algorithm as a std::string.

Definition at line 325 of file d2_config.h.

◆ getDigestbits()

uint32_t isc::d2::TSIGKeyInfo::getDigestbits ( ) const
inline

Getter which returns the key's minimum truncated length.

Returns
returns the minimum truncated length or 0 as an uint32_t

Definition at line 332 of file d2_config.h.

◆ getName()

const std::string isc::d2::TSIGKeyInfo::getName ( ) const
inline

Getter which returns the key's name.

Returns
returns the name as a std::string.

Definition at line 318 of file d2_config.h.

References name_.

◆ getSecret()

const std::string isc::d2::TSIGKeyInfo::getSecret ( ) const
inline

Getter which returns the key's secret.

Returns
returns the secret as a std::string.

Definition at line 339 of file d2_config.h.

◆ getTSIGKey()

const D2TsigKeyPtr& isc::d2::TSIGKeyInfo::getTSIGKey ( ) const
inline

Getter which returns the TSIG key used to sign and verify messages.

Returns
const pointer reference to D2TsigKeyPtr

Definition at line 347 of file d2_config.h.

References name_.

◆ stringToAlgorithmName()

const dns::Name & isc::d2::TSIGKeyInfo::stringToAlgorithmName ( const std::string &  algorithm_id)
static

Converts algorithm id to dns::TSIGKey algorithm dns::Name.

Parameters
algorithm_idstring value to translate into an algorithm name. Currently supported values are (case insensitive):
  1. "HMAC-MD5"
  2. "HMAC-SHA1"
  3. "HMAC-SHA224"
  4. "HMAC-SHA256"
  5. "HMAC-SHA384"
  6. "HMAC-SHA512"
Returns
const reference to a dns::Name containing the algorithm name
Exceptions
BadValueif ID isn't recognized.

Definition at line 146 of file d2_config.cc.

References HMAC_MD5_STR, HMAC_SHA1_STR, HMAC_SHA224_STR, HMAC_SHA256_STR, HMAC_SHA384_STR, HMAC_SHA512_STR, isc::dns::TSIGKey::HMACMD5_NAME(), isc::dns::TSIGKey::HMACSHA1_NAME(), isc::dns::TSIGKey::HMACSHA224_NAME(), isc::dns::TSIGKey::HMACSHA256_NAME(), isc::dns::TSIGKey::HMACSHA384_NAME(), isc::dns::TSIGKey::HMACSHA512_NAME(), isc_throw, isc::dns::Name::toText(), and isc::Exception::what().

Referenced by isc::d2::TSIGKeyInfoParser::parse().

+ Here is the call graph for this function:

◆ toElement()

ElementPtr isc::d2::TSIGKeyInfo::toElement ( ) const
virtual

Unparse a configuration object.

Returns
a pointer to a configuration

Implements isc::data::CfgToElement.

Definition at line 185 of file d2_config.cc.

References isc::data::UserContext::contextToElement().

+ Here is the call graph for this function:

Member Data Documentation

◆ HMAC_MD5_STR

const char * isc::d2::TSIGKeyInfo::HMAC_MD5_STR = "HMAC-MD5"
static

Defines string values for the supported TSIG algorithms.

Definition at line 270 of file d2_config.h.

Referenced by isc::d2::operator<<(), and stringToAlgorithmName().

◆ HMAC_SHA1_STR

const char * isc::d2::TSIGKeyInfo::HMAC_SHA1_STR = "HMAC-SHA1"
static

Definition at line 271 of file d2_config.h.

Referenced by isc::d2::operator<<(), and stringToAlgorithmName().

◆ HMAC_SHA224_STR

const char * isc::d2::TSIGKeyInfo::HMAC_SHA224_STR = "HMAC-SHA224"
static

Definition at line 273 of file d2_config.h.

Referenced by isc::d2::operator<<(), and stringToAlgorithmName().

◆ HMAC_SHA256_STR

const char * isc::d2::TSIGKeyInfo::HMAC_SHA256_STR = "HMAC-SHA256"
static

Definition at line 272 of file d2_config.h.

Referenced by isc::d2::operator<<(), and stringToAlgorithmName().

◆ HMAC_SHA384_STR

const char * isc::d2::TSIGKeyInfo::HMAC_SHA384_STR = "HMAC-SHA384"
static

Definition at line 274 of file d2_config.h.

Referenced by isc::d2::operator<<(), and stringToAlgorithmName().

◆ HMAC_SHA512_STR

const char * isc::d2::TSIGKeyInfo::HMAC_SHA512_STR = "HMAC-SHA512"
static

Definition at line 275 of file d2_config.h.

Referenced by isc::d2::operator<<(), and stringToAlgorithmName().


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