OpenVPN 3 Core Library
Loading...
Searching...
No Matches
openvpn::Base64 Class Reference

#include <base64.hpp>

Classes

class  ConstUCharWrap
 
class  UCharWrap
 

Public Member Functions

 OPENVPN_SIMPLE_EXCEPTION (base64_decode_out_of_bound_error)
 
 OPENVPN_SIMPLE_EXCEPTION (base64_bad_map)
 
 OPENVPN_SIMPLE_EXCEPTION (base64_decode_error)
 
 Base64 (const char *altmap=nullptr)
 
template<typename V >
std::string encode (const V &data) const
 
std::string encode (const void *data, size_t size) const
 
size_t decode (void *data, size_t len, const std::string &str) const
 
std::string decode (const std::string &str) const
 
template<typename V >
void decode (V &dest, const std::string &str) const
 
template<typename V >
bool is_base64 (const V &data, const size_t expected_decoded_length) const
 

Static Public Member Functions

static size_t decode_size_max (const size_t encode_size)
 
static size_t encode_size_max (const size_t decode_size)
 

Private Member Functions

bool is_base64_char (const char c) const
 
unsigned int decode_base64_char (const char c) const
 
unsigned int token_decode (const char *token, const ptrdiff_t len, unsigned int &marker) const
 

Static Private Member Functions

static size_t encoded_len (const size_t decoded_len)
 
static size_t num_eq (const size_t decoded_len)
 

Private Attributes

unsigned char enc [64]
 
unsigned char dec [128]
 
unsigned char equal
 

Detailed Description

Definition at line 27 of file base64.hpp.

Constructor & Destructor Documentation

◆ Base64()

openvpn::Base64::Base64 ( const char *  altmap = nullptr)
inline

Definition at line 92 of file base64.hpp.

Member Function Documentation

◆ decode() [1/3]

std::string openvpn::Base64::decode ( const std::string &  str) const
inline

Definition at line 193 of file base64.hpp.

◆ decode() [2/3]

template<typename V >
void openvpn::Base64::decode ( V &  dest,
const std::string &  str 
) const
inline

Definition at line 202 of file base64.hpp.

◆ decode() [3/3]

size_t openvpn::Base64::decode ( void *  data,
size_t  len,
const std::string &  str 
) const
inline

Decodes data from the passed string and stores the result in data

Parameters
dataDestination of the decoded data
lenLength of the region in data
strBase64 string to decode
Returns
Number of bytes written to data

Definition at line 186 of file base64.hpp.

Here is the caller graph for this function:

◆ decode_base64_char()

unsigned int openvpn::Base64::decode_base64_char ( const char  c) const
inlineprivate

Definition at line 249 of file base64.hpp.

Here is the caller graph for this function:

◆ decode_size_max()

static size_t openvpn::Base64::decode_size_max ( const size_t  encode_size)
inlinestatic

Definition at line 128 of file base64.hpp.

◆ encode() [1/2]

template<typename V >
std::string openvpn::Base64::encode ( const V &  data) const
inline

Definition at line 139 of file base64.hpp.

Here is the caller graph for this function:

◆ encode() [2/2]

std::string openvpn::Base64::encode ( const void *  data,
size_t  size 
) const
inline

Definition at line 173 of file base64.hpp.

◆ encode_size_max()

static size_t openvpn::Base64::encode_size_max ( const size_t  decode_size)
inlinestatic

Definition at line 133 of file base64.hpp.

Here is the caller graph for this function:

◆ encoded_len()

static size_t openvpn::Base64::encoded_len ( const size_t  decoded_len)
inlinestaticprivate

Definition at line 282 of file base64.hpp.

Here is the caller graph for this function:

◆ is_base64()

template<typename V >
bool openvpn::Base64::is_base64 ( const V &  data,
const size_t  expected_decoded_length 
) const
inline

Definition at line 219 of file base64.hpp.

Here is the caller graph for this function:

◆ is_base64_char()

bool openvpn::Base64::is_base64_char ( const char  c) const
inlineprivate

Definition at line 243 of file base64.hpp.

Here is the caller graph for this function:

◆ num_eq()

static size_t openvpn::Base64::num_eq ( const size_t  decoded_len)
inlinestaticprivate

Definition at line 287 of file base64.hpp.

Here is the caller graph for this function:

◆ OPENVPN_SIMPLE_EXCEPTION() [1/3]

openvpn::Base64::OPENVPN_SIMPLE_EXCEPTION ( base64_bad_map  )

◆ OPENVPN_SIMPLE_EXCEPTION() [2/3]

openvpn::Base64::OPENVPN_SIMPLE_EXCEPTION ( base64_decode_error  )

◆ OPENVPN_SIMPLE_EXCEPTION() [3/3]

openvpn::Base64::OPENVPN_SIMPLE_EXCEPTION ( base64_decode_out_of_bound_error  )

◆ token_decode()

unsigned int openvpn::Base64::token_decode ( const char *  token,
const ptrdiff_t  len,
unsigned int &  marker 
) const
inlineprivate

Definition at line 260 of file base64.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ dec

unsigned char openvpn::Base64::dec[128]
private

Definition at line 293 of file base64.hpp.

◆ enc

unsigned char openvpn::Base64::enc[64]
private

Definition at line 292 of file base64.hpp.

◆ equal

unsigned char openvpn::Base64::equal
private

Definition at line 294 of file base64.hpp.


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