Kea 2.7.5
isc::util::encode Namespace Reference

Classes

class  Base16Encoder
 Class for encoding and decoding binary data using Base16 (aka Hex) as described in RFC 4648. More...
 
class  Base32HexEncoder
 Class for encoding and decoding binary data using Base32Hex as described in RFC 4648. More...
 
class  Base64Encoder
 Class for encoding and decoding binary data using Base64 as described in RFC 4648. More...
 
class  BaseNEncoder
 Class for encoding and decoding binary data using an algorithm described in RFC 4648. More...
 

Functions

void decodeBase32Hex (const std::string &encoded_str, std::vector< uint8_t > &output)
 Decode a base32-hex encoded string into binary data.
 
void decodeBase64 (const std::string &encoded_str, std::vector< uint8_t > &output)
 Decode a base64 encoded string into binary data.
 
void decodeHex (const std::string &encoded_str, std::vector< uint8_t > &output)
 Decode a base16 encoded string into binary data.
 
string encodeBase32Hex (const std::vector< uint8_t > &binary)
 Encode binary data in the base32-hex format.
 
string encodeBase64 (const std::vector< uint8_t > &binary)
 Encode binary data in the base64 format.
 
string encodeHex (const std::vector< uint8_t > &binary)
 Encode binary data in the base16 format.
 
std::vector< uint8_t > encodeUtf8 (const std::string &value)
 Encode value string into UTF-8.
 
std::string toHex (std::string value)
 Encode in hexadecimal inline.
 

Function Documentation

◆ decodeBase32Hex()

void isc::util::encode::decodeBase32Hex ( const std::string & encoded_str,
std::vector< uint8_t > & output )

Decode a base32-hex encoded string into binary data.

Parameters
encoded_strstring containing a base32-hex encoded value.
[out]outputvector into which the decoded binary data is stored.
Exceptions
BadValueif the input string is invalid.

Definition at line 355 of file encode.cc.

References isc::util::encode::BaseNEncoder::decode().

+ Here is the call graph for this function:

◆ decodeBase64()

void isc::util::encode::decodeBase64 ( const std::string & encoded_str,
std::vector< uint8_t > & output )

Decode a base64 encoded string into binary data.

Parameters
encoded_strstring containing a base64 encoded value.
[out]outputvector into which the decoded binary data is stored.
Exceptions
BadValueif the input string is invalid.

Definition at line 343 of file encode.cc.

References isc::util::encode::BaseNEncoder::decode().

Referenced by isc::dns::TSIGKey::TSIGKey(), and isc::yang::Translator::decode64().

+ Here is the call graph for this function:

◆ decodeHex()

void isc::util::encode::decodeHex ( const std::string & encoded_str,
std::vector< uint8_t > & output )

Decode a base16 encoded string into binary data.

Parameters
encoded_strstring containing a base16 encoded value.
[out]outputvector into which the decoded binary data is stored.
Exceptions
BadValueif the input string is invalid.

Definition at line 367 of file encode.cc.

References isc::util::encode::BaseNEncoder::decode().

Referenced by isc::dhcp::TokenHexString::TokenHexString(), user_chk::UserId::UserId(), isc::dhcp::LeaseMgr::addExtendedInfo6(), isc::util::str::decodeFormattedHexString(), isc::dhcp::LeaseMgr::extractLease4ExtendedInfo(), isc::dhcp_ddns::D2Dhcid::fromStr(), isc::dhcp::AuthKey::setAuthKey(), isc::dhcp::CfgDUID::setIdentifier(), isc::dhcp::LeaseMgr::upgradeLease4ExtendedInfo(), isc::dhcp::LeaseMgr::upgradeLease6ExtendedInfo(), and isc::dhcp::OptionDataTypeUtil::writeBinary().

+ Here is the call graph for this function:

◆ encodeBase32Hex()

std::string isc::util::encode::encodeBase32Hex ( const std::vector< uint8_t > & binary)

Encode binary data in the base32-hex format.

Parameters
binaryvector object storing the data to be encoded.
Returns
string containing the base32-hex encoded value.

Definition at line 349 of file encode.cc.

◆ encodeBase64()

std::string isc::util::encode::encodeBase64 ( const std::vector< uint8_t > & binary)

Encode binary data in the base64 format.

Parameters
binaryvector object storing the data to be encoded.
Returns
string containing the base64 encoded value.

Definition at line 337 of file encode.cc.

Referenced by isc::yang::Translator::encode64(), and isc::dns::TSIGKey::toText().

◆ encodeHex()

◆ encodeUtf8()

std::vector< uint8_t > isc::util::encode::encodeUtf8 ( const std::string & value)

Encode value string into UTF-8.

Parameters
valueA string in latin1 i.e. no encoding.
Returns
A vector object storing the data encoded in UTF-8.

Definition at line 15 of file utf8.cc.

◆ toHex()

std::string isc::util::encode::toHex ( std::string value)
inline

Encode in hexadecimal inline.

Parameters
valuethe value to encode.
Returns
0x followed by the value encoded in hex.

Definition at line 293 of file encode.h.

References encodeHex().

+ Here is the call graph for this function: