| Kea 3.0.2-git

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_str | string containing a base32-hex encoded value.
  [out] | output | vector into which the decoded binary data is stored.

Exceptions

  BadValue | if 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_str | string containing a base64 encoded value.
  [out] | output | vector into which the decoded binary data is stored.

Exceptions

  BadValue | if 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_str | string containing a base16 encoded value.
  [out] | output | vector into which the decoded binary data is stored.

Exceptions

  BadValue | if 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::radius::Attributes::fromElement(), isc::dhcp_ddns::D2Dhcid::fromStr(), isc::radius::RadiusAttributeParser::parse(), 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

  binary | vector object storing the data to be encoded.

Returns
  string containing the base32-hex encoded value.

Definition at line 349 of file encode.cc.

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

Here is the call graph for this function:

## ◆ encodeBase64()

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

Encode binary data in the base64 format.

Parameters

  binary | vector object storing the data to be encoded.

Returns
  string containing the base64 encoded value.

Definition at line 337 of file encode.cc.

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

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

Here is the call graph for this function:

## ◆ encodeHex()

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

Encode binary data in the base16 format.

Parameters

  binary | vector object containing the data to be encoded.

Returns
  string containing the base16 encoded value.

Definition at line 361 of file encode.cc.

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

Referenced by isc::dhcp::TokenVendor::evaluate(), isc::dhcp::TokenVendorClass::evaluate(), isc::config::BaseCommandMgr::getHash(), isc::dhcp::Host::getIdentifierAsText(), isc::d2::D2CfgMgr::reverseV6Address(), isc::dhcp::CfgDUID::toElement(), isc::host_cache::toElement(), isc::radius::AttrString::toElement(), isc::dhcp::Host::toElement4(), isc::dhcp::Host::toElement6(), isc::dhcp::CfgOption::toElementWithMetadata(), toHex(), isc::dhcp::Option::toHexString(), isc::dhcp_ddns::D2Dhcid::toStr(), isc::dhcp::AuthKey::toText(), isc::dhcp::Option6Auth::toText(), isc::dhcp::Option6PDExclude::toText(), isc::dhcp::AllocEngine::updateLease4ExtendedInfo(), isc::dhcp::AllocEngine::updateLease6ExtendedInfo(), isc::dhcp::LeaseMgr::upgradeLease4ExtendedInfo(), and isc::dhcp::LeaseMgr::upgradeLease6ExtendedInfo().

Here is the call graph for this function:

## ◆ encodeUtf8()

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

Encode value string into UTF-8.

Parameters

  value | A 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

  value | the 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: