Kea
1.9.9-git
|
Namespaces | |
clang_unnamed_namespace_workaround | |
Functions | |
void | decodeBase32Hex (const std::string &input, std::vector< uint8_t > &result) |
Decode a text encoded in the base32hex format into the original data. More... | |
void | decodeBase64 (const std::string &input, std::vector< uint8_t > &result) |
Decode a text encoded in the base64 format into the original data. More... | |
void | decodeHex (const std::string &input, std::vector< uint8_t > &result) |
Decode a text encoded in the base16 ('hex') format into the original data. More... | |
std::string | encodeBase32Hex (const std::vector< uint8_t > &binary) |
Encode binary data in the base32hex format. More... | |
std::string | encodeBase64 (const std::vector< uint8_t > &binary) |
Encode binary data in the base64 format. More... | |
string | encodeHex (const std::vector< uint8_t > &binary) |
Encode binary data in the base16 ('hex') format. More... | |
std::vector< uint8_t > | encodeUtf8 (const std::string &value) |
Encode value string into UTF-8. More... | |
std::string | toHex (std::string value) |
Encode in hexadecimal inline. More... | |
void isc::util::encode::decodeBase32Hex | ( | const std::string & | input, |
std::vector< uint8_t > & | result | ||
) |
Decode a text encoded in the base32hex format into the original data.
The underlying implementation is shared with decodeBase64
, and all description except the format (base32hex) equally applies.
Note: the encoding format is base32hex, not base32.
input | A text encoded in the base32hex format. |
result | A vector in which the decoded data is to be stored. |
void isc::util::encode::decodeBase64 | ( | const std::string & | input, |
std::vector< uint8_t > & | result | ||
) |
Decode a text encoded in the base64 format into the original data.
The input
argument must be a valid string represented in the base64 format as specified in RFC4648. Space characters (spaces, tabs, newlines) can be included in input
and will be ignored. Without spaces, the length of string must be a multiple of 4 bytes with necessary paddings. Also it must be encoded using the canonical encoding (see RFC4648). If any of these conditions is not met, an exception of class isc::BadValue
will be thrown.
If result
doesn't have sufficient capacity to store all decoded data and memory allocation fails, a corresponding standard exception will be thrown. If the caller knows the necessary length (which can in theory be calculated from the input string), this situation can be avoided by reserving sufficient space for result
beforehand.
Any existing data in result
will be removed. This is the case in some of the cases where an exception is thrown; that is, this function only provides the basic exception guarantee.
input | A text encoded in the base64 format. |
result | A vector in which the decoded data is to be stored. |
Definition at line 454 of file base_n.cc.
Referenced by isc::dns::TSIGKey::TSIGKey().
void isc::util::encode::decodeHex | ( | const std::string & | input, |
std::vector< uint8_t > & | result | ||
) |
Decode a text encoded in the base16 ('hex') format into the original data.
The underlying implementation is shared with decodeBase64
, and most of the description except the format (base16) equally applies. Another notable exception is that the base16 encoding doesn't require padding, so padding related considerations and the notion of canonical encoding don't apply.
input | A text encoded in the base16 format. |
result | A vector in which the decoded data is to be stored. |
Definition at line 474 of file base_n.cc.
Referenced by isc::util::str::decodeFormattedHexString(), isc::dhcp_ddns::D2Dhcid::fromStr(), isc::dhcp::AuthKey::setAuthKey(), isc::dhcp::CfgDUID::setIdentifier(), isc::dhcp::TokenHexString::TokenHexString(), user_chk::UserId::UserId(), and isc::dhcp::OptionDataTypeUtil::writeBinary().
string isc::util::encode::encodeBase32Hex | ( | const std::vector< uint8_t > & | binary | ) |
Encode binary data in the base32hex format.
The underlying implementation is shared with encodeBase64
, and all description except the format (base32hex) equally applies.
Note: the encoding format is base32hex, not base32.
binary | A vector object storing the data to be encoded. |
string isc::util::encode::encodeBase64 | ( | const std::vector< uint8_t > & | binary | ) |
Encode binary data in the base64 format.
This function returns a new std::string
object that stores a text encoded in the base64 format for the given binary
data. The resulting string will be a valid, canonical form of base64 representation as specified in RFC4648.
If memory allocation for the returned string fails, a corresponding standard exception will be thrown. This function never throws exceptions otherwise.
binary | A vector object storing the data to be encoded. |
Definition at line 449 of file base_n.cc.
Referenced by isc::dns::TSIGKey::toText().
std::string isc::util::encode::encodeHex | ( | const std::vector< uint8_t > & | binary | ) |
Encode binary data in the base16 ('hex') format.
The underlying implementation is shared with encodeBase64
, and most of the description except the format (base16) equally applies. Another notable exception is that the base16 encoding doesn't require padding, so padding related considerations and the notion of canonical encoding don't apply.
binary | A vector object storing the data to be encoded. |
Definition at line 469 of file base_n.cc.
Referenced by isc::dhcp::TokenVendor::evaluate(), isc::dhcp::TokenVendorClass::evaluate(), isc::dhcp::Host::getIdentifierAsText(), isc::d2::D2CfgMgr::reverseV6Address(), isc::dhcp::CfgDUID::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::Option6Auth::toText(), isc::dhcp::Option6PDExclude::toText(), isc::dhcp::AuthKey::toText(), and isc::dhcp::AllocEngine::updateLease6ExtendedInfo().
std::vector< uint8_t > isc::util::encode::encodeUtf8 | ( | const std::string & | value | ) |
|
inline |
Encode in hexadecimal inline.
value | the value to encode |
Definition at line 53 of file hex.h.
References encodeHex().
Referenced by isc::dhcp::TokenHexString::evaluate(), isc::dhcp::TokenIpAddress::evaluate(), isc::dhcp::TokenOption::evaluate(), isc::dhcp::TokenPkt::evaluate(), isc::dhcp::TokenPkt4::evaluate(), isc::dhcp::TokenPkt6::evaluate(), isc::dhcp::TokenRelay6Field::evaluate(), isc::dhcp::TokenEqual::evaluate(), isc::dhcp::TokenSubstring::evaluate(), isc::dhcp::TokenConcat::evaluate(), isc::dhcp::TokenIfElse::evaluate(), isc::dhcp::TokenToHexString::evaluate(), and isc::dhcp::TokenSubOption::evaluate().