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

Static Public Member Functions

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

Static Public Attributes

static const char * HMAC_MD5_STR = "HMAC-MD5"
 Defines string values for the supported TSIG algorithms.
 
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)
 

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,
std::string secret_file = "",
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.)
secret_fileThe file name where the secret can be found.
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 130 of file d2_config.cc.

◆ ~TSIGKeyInfo()

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

Destructor.

Definition at line 138 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 327 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 334 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 320 of file d2_config.h.

◆ 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 341 of file d2_config.h.

◆ getSecretFile()

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

Getter which returns the secret file name.

Returns
returns the secret file name.

Definition at line 348 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 356 of file d2_config.h.

◆ 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 142 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(), and isc_throw.

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 181 of file d2_config.cc.

References isc::data::UserContext::contextToElement(), isc::data::Element::create(), and isc::data::Element::createMap().

+ 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 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 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::TSIGKeyInfoParser::parse(), 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::TSIGKeyInfoParser::parse(), 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::TSIGKeyInfoParser::parse(), 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::TSIGKeyInfoParser::parse(), and stringToAlgorithmName().


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