CppCMS
Functions
cppcms::b64url Namespace Reference

this namespace provides functions useful for modified Base64 encoding for URL. This encoding does not insert newline characters, do not pad the text with = character and use "_" and "-" instead of "+" and "/" characters reserved by URL format for special purposes. More...

Functions

int CPPCMS_API encoded_size (size_t s)
int CPPCMS_API decoded_size (size_t s)
unsigned char CPPCMS_API * encode (unsigned char const *begin, unsigned char const *end, unsigned char *target)
void encode (unsigned char const *begin, unsigned char const *end, std::ostream &output)
unsigned char CPPCMS_API * decode (unsigned char const *begin, unsigned char const *end, unsigned char *target)
bool CPPCMS_API decode (std::string const &input, std::string &output)
std::string CPPCMS_API encode (std::string const &input)

Detailed Description

this namespace provides functions useful for modified Base64 encoding for URL. This encoding does not insert newline characters, do not pad the text with = character and use "_" and "-" instead of "+" and "/" characters reserved by URL format for special purposes.


Function Documentation

unsigned char CPPCMS_API* cppcms::b64url::decode ( unsigned char const *  begin,
unsigned char const *  end,
unsigned char *  target 
)

Perform base64 URL decoding of the binary data in range [begin,end), and store it to output buffer target. The size of target storage should have a capacity calculated with encoded_size(end-begin).

Pointer to the first character directly after text string ends is returned. Invalid codes are substituted by 0 values.

bool CPPCMS_API cppcms::b64url::decode ( std::string const &  input,
std::string &  output 
)

Perform base64 URL decoding of the textual data input, and store it to output.

If the source is invalid returns false

int CPPCMS_API cppcms::b64url::decoded_size ( size_t  s)

Calculate required buffer size of base64-url compatible decoding for source of size s

Note, if original size is invalid, negative value is returned

unsigned char CPPCMS_API* cppcms::b64url::encode ( unsigned char const *  begin,
unsigned char const *  end,
unsigned char *  target 
)

Perform base64 URL encoding of the binary data in range [begin,end), and store it to output buffer target. The size of target storage should have a capacity calculated with encoded_size(end-begin).

Pointer to the first character directly after text string ends is returned.

void cppcms::b64url::encode ( unsigned char const *  begin,
unsigned char const *  end,
std::ostream &  output 
)

Perform base64 URL encoding of the binary data in range [begin,end), and write it to output stream

std::string CPPCMS_API cppcms::b64url::encode ( std::string const &  input)

Perform base64 URL encoding of the binary data input, and return it

int CPPCMS_API cppcms::b64url::encoded_size ( size_t  s)

Calculate required buffer size of base64-url compatible encoding for source of size s