Kea 2.7.5
|
Authentication keys. More...
#include <host.h>
Public Member Functions | |
AuthKey () | |
Constructor. | |
AuthKey (const std::string &key) | |
Constructor. | |
AuthKey (const std::vector< uint8_t > &key) | |
Constructor. | |
const std::vector< uint8_t > & | getAuthKey () const |
Return auth key. | |
bool | operator!= (const AuthKey &other) const |
Inequality operator. | |
bool | operator== (const AuthKey &other) const |
Equality operator. | |
void | setAuthKey (const std::string &key) |
Set auth key value from hexadecimal. | |
void | setAuthKey (const std::vector< uint8_t > &key) |
Set auth key value from binary. | |
std::string | toText () const |
Return text format for keys. | |
Static Public Member Functions | |
static std::vector< uint8_t > | getRandomKeyString () |
Random string is generated by default will be used for the keys to be used for signing Reconfigure Message. | |
Authentication keys.
This class represents authentication keys to be used for calculating HMAC in the authentication field of the reconfigure message.
isc::dhcp::AuthKey::AuthKey | ( | const std::vector< uint8_t > & | key | ) |
Constructor.
Constructor for assigning auth keys in host reservation. Ensures the key length is not greater than 16 bytes.
key | auth key in binary to be stored. |
Definition at line 28 of file host.cc.
References setAuthKey().
isc::dhcp::AuthKey::AuthKey | ( | const std::string & | key | ) |
Constructor.
Constructor for assigning auth keys in host reservation. Ensures the key length is not greater than AUTH_KEY_LEN (16) bytes so TEXT_AUTH_KEY_LEN (32) hexadecimal digits. See setKey
for constraints on its input format.
key | auth key in hexadecimal to be stored. |
Definition at line 32 of file host.cc.
References setAuthKey().
isc::dhcp::AuthKey::AuthKey | ( | ) |
Constructor.
Constructor for generating auth keys, with no argument. shall use the internal function for generationg random keys.
Definition at line 36 of file host.cc.
References getRandomKeyString().
|
inline |
|
static |
Random string is generated by default will be used for the keys to be used for signing Reconfigure Message.
Definition at line 41 of file host.cc.
References isc::dhcp::AUTH_KEY_LEN, and isc::cryptolink::random().
Referenced by AuthKey().
bool isc::dhcp::AuthKey::operator!= | ( | const AuthKey & | other | ) | const |
bool isc::dhcp::AuthKey::operator== | ( | const AuthKey & | other | ) | const |
void isc::dhcp::AuthKey::setAuthKey | ( | const std::string & | key | ) |
Set auth key value from hexadecimal.
Set the key value. If the size is greater than 16 bytes, we resize to 16 bytes.
key | auth key in hexadecimal to be stored. |
BadValue | if the string is not a valid hexadecimal encoding, for instance has a not hexadecimal or odd number of digits. |
Definition at line 62 of file host.cc.
References isc::util::encode::decodeHex(), isc_throw, setAuthKey(), and isc::Exception::what().
void isc::dhcp::AuthKey::setAuthKey | ( | const std::vector< uint8_t > & | key | ) |
Set auth key value from binary.
Set the key value. Doesn't throw an exception.
key | auth key in binary to be stored |
Definition at line 54 of file host.cc.
References isc::dhcp::AUTH_KEY_LEN.
Referenced by AuthKey(), AuthKey(), and setAuthKey().
std::string isc::dhcp::AuthKey::toText | ( | ) | const |
Return text format for keys.
Definition at line 46 of file host.cc.
References isc::util::encode::encodeHex().
Referenced by isc::dhcp::Host::toText().