Kea 2.5.8
isc::util::encode::Base64Encoder Class Reference

Class for encoding and decoding binary data using Base64 as described in RFC 4648. More...

#include <encode.h>

+ Inheritance diagram for isc::util::encode::Base64Encoder:

Public Member Functions

 Base64Encoder ()
 Constructor.
 
 ~Base64Encoder ()=default
 Destructor.
 
- Public Member Functions inherited from isc::util::encode::BaseNEncoder
 BaseNEncoder (const std::string &algorithm, const char *digit_set, const std::vector< uint8_t > &bits_table, size_t bits_per_digit, size_t digits_per_group, const char pad_char, size_t max_pad, bool case_sensitive)
 Constructor.
 
virtual ~BaseNEncoder ()=default
 Destructor.
 
char bitsToDigit (uint8_t bits)
 Translate a byte of binary data into the appropriate algorithm digit.
 
void decode (const std::string &encoded_str, std::vector< uint8_t > &output)
 Decodes an encoded string using the encoder's algorithm.
 
uint8_t digitToBits (uint8_t digit)
 Translate a digit into the appropriate algorithm bit value.
 
std::string encode (const std::vector< uint8_t > &input)
 Encodes binary data using the encoder's algorithm.
 
std::string getAlgorithm () const
 Get the algorithm name.
 
size_t getBitsPerDigit ()
 Get the number of data bits represented by a digit.
 
const std::vector< uint8_t > & getBitsTable () const
 Get the digit lookup table.
 
const char * getDigitSet () const
 Get the digit set.
 
size_t getDigitsPerGroup () const
 Get the number of digits contained in a group.
 
size_t getMaxBitsToDigit ()
 Get the maxium index value of the digit set.
 
size_t getMaxDigitToBits ()
 Get the maxium index value of the algorithm bit table.
 
size_t getMaxPad ()
 Get the maximum number of pad characters in a group.
 
uint8_t getPadChar () const
 Get the character used for padding out to group size (0 means no padding)
 
bool isCaseSensitive ()
 Indicates whether or not the algorithm's digit set is case-sensitive.
 

Static Public Attributes

static const std::vector< uint8_t > BITS_TABLE
 Table that maps Base64 digits to their binary data value.
 
static const char * DIGIT_SET
 Set of digits used for encoding in Base64.
 

Additional Inherited Members

- Protected Attributes inherited from isc::util::encode::BaseNEncoder
std::string algorithm_
 Name of the algorithm, used for logging.
 
size_t bits_per_digit_
 Number of data bits represented by a digit.
 
std::vector< uint8_t > bits_table_
 Table to translate digits to data used during decoding.
 
bool case_sensitive_
 Indicates whether or not the algorithm's digit set is case-sensitive.
 
const char * digit_set_
 Set of digits (i.e. alphabet) used for encoding.
 
size_t digits_per_group_
 Number of digits contained in a group.
 
size_t max_bits_to_digit_
 Maxium index value of the digit set.
 
size_t max_digit_to_bits_
 Maxium index value of the algorithm bit table.
 
size_t max_pad_
 Maximum number of pad characters in a group.
 
const char pad_char_
 Character used for padding out to group size (0 means no padding)
 

Detailed Description

Class for encoding and decoding binary data using Base64 as described in RFC 4648.

Definition at line 191 of file encode.h.

Constructor & Destructor Documentation

◆ Base64Encoder()

isc::util::encode::Base64Encoder::Base64Encoder ( )
inline

Constructor.

Definition at line 200 of file encode.h.

◆ ~Base64Encoder()

isc::util::encode::Base64Encoder::~Base64Encoder ( )
default

Destructor.

Member Data Documentation

◆ BITS_TABLE

const std::vector< uint8_t > isc::util::encode::Base64Encoder::BITS_TABLE
static
Initial value:
= {
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xee,0xee,0xee,0xee,0xee,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xee,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,62,0xff,0xff,0xff,63,
52,53,54,55,56,57,58,59,60,61,0xff,0xff,0xff, 0,0xff,0xff,
0xff, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,
15,16,17,18,19,20,21,22,23,24,25,0xff,0xff,0xff,0xff,0xff,
0xff,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,
41,42,43,44,45,46,47,48,49,50,51,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
}

Table that maps Base64 digits to their binary data value.

Definition at line 197 of file encode.h.

◆ DIGIT_SET

const char * isc::util::encode::Base64Encoder::DIGIT_SET
static
Initial value:
= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
"+/"

Set of digits used for encoding in Base64.

Definition at line 194 of file encode.h.


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