scclib
Stable Cloud Computing C++ Library
Static Public Member Functions | List of all members
scc::encode::Base64 Class Reference

Static Public Member Functions

template<class T >
static void base64_encode (const std::vector< T > &, std::string &) noexcept
 Convert from binary to base64 string. More...
 
static std::string str_to_base64 (const std::string &s) noexcept
 Convert from string to base64 string. More...
 
template<class T >
static bool base64_decode (const std::string &, std::vector< T > &) noexcept
 Convert from base64 string to binary. More...
 
static std::string base64_to_str (const std::string &) noexcept
 Convert from base64 string to string. More...
 
static std::string base64_to_base64url (const std::string &) noexcept
 Convert from base64 to base64url. More...
 
static std::string base64url_to_base64 (const std::string &) noexcept
 Convert from base64url to base64.
 

Detailed Description

Examples
scclib/encode/unittest/base64.cc.

Definition at line 52 of file base64.h.

Member Function Documentation

◆ base64_decode()

template<class T >
template bool Base64::base64_decode< unsigned char > ( const std::string &  ,
std::vector< T > &   
)
staticnoexcept

Convert from base64 string to binary.

Parameters
sinput base 64 string
voutput binary data
Return values
trueif conversion successful
falseif conversion failed due to invalid input format

Definition at line 117 of file base64.cc.

◆ base64_encode()

template<class T >
template void Base64::base64_encode< unsigned char > ( const std::vector< T > &  ,
std::string &   
)
staticnoexcept

Convert from binary to base64 string.

Parameters
vininput binary data
soutput base64 encoded string

See https://tools.ietf.org/html/rfc4648

Extra stuff

Definition at line 69 of file base64.cc.

◆ base64_to_base64url()

std::string Base64::base64_to_base64url ( const std::string &  b)
staticnoexcept

Convert from base64 to base64url.

See https://tools.ietf.org/html/rfc4648

base64url replaces, '+' with '-', '/' with '_', and removes any padding '=' characters.

It is also known as "Base 64 with URL and Filename Safe Encoding".

Definition at line 178 of file base64.cc.

◆ base64_to_str()

std::string Base64::base64_to_str ( const std::string &  s)
staticnoexcept

Convert from base64 string to string.

Parameters
sinput base 64 string
Return values
base64_stringif conversion succeeded
empty_stringif conversion failed

Definition at line 168 of file base64.cc.

◆ str_to_base64()

std::string Base64::str_to_base64 ( const std::string &  s)
staticnoexcept

Convert from string to base64 string.

Parameters
sinput string
Return values
base64_stringbase64 encoded string

Definition at line 108 of file base64.cc.


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