25#ifndef __JOIN_BASE64_HPP__
26#define __JOIN_BASE64_HPP__
48 std::stringstream oss;
49 for (
size_t i = 0; i < bin.size (); ++i)
51 oss << std::hex << std::setw (2) << std::setfill ('0') << static_cast <uint32_t> (bin[i]);
110 virtual int_type
overflow (int_type c = traits_type::eof ())
override;
116 std::unique_ptr <char []>
_buf;
232 virtual int_type
overflow (int_type c = traits_type::eof ())
override;
238 std::unique_ptr <char []>
_buf;
322 static std::string
encode (
const char* data,
size_t size);
329 static std::string
encode (
const std::string& data);
base64 encode, decode class.
Definition base64.hpp:304
static std::string encode(const char *data, size_t size)
encode data.
Definition base64.cpp:343
static BytesArray decode(const std::string &data)
decode a base64 encoded string.
Definition base64.cpp:372
Base64()=delete
create the Base64 instance.
~Base64()=delete
destroy the Base64 instance.
decoder.
Definition base64.hpp:251
Decoder(const Decoder &other)=delete
copy constructor.
Decoderbuf _decoderbuf
associated decoder stream buffer.
Definition base64.hpp:297
Decoder()
default constructor.
Definition base64.cpp:298
Decoder & operator=(const Decoder &other)=delete
copy assignment operator.
BytesArray get()
get decoded data.
Definition base64.cpp:329
virtual ~Decoder()=default
destroy instance.
decoder stream buffer.
Definition base64.hpp:182
static const std::streamsize _bufsize
internal buffer size.
Definition base64.hpp:235
Decoderbuf & operator=(const Decoderbuf &other)=delete
copy assignment operator.
Decoderbuf(const Decoderbuf &other)=delete
copy constructor.
std::unique_ptr< char[]> _buf
internal buffer.
Definition base64.hpp:238
BytesArray _out
output buffer.
Definition base64.hpp:244
EvpEncodeCtxPtr _decodectx
decode context.
Definition base64.hpp:241
Decoderbuf()
create decoder stream buffer instance.
Definition base64.cpp:190
virtual ~Decoderbuf()=default
destroy encoder stream buffer instance.
virtual int_type overflow(int_type c=traits_type::eof()) override
writes characters to the associated output sequence from the put area.
Definition base64.cpp:248
BytesArray get()
get decoded data.
Definition base64.cpp:224
encoder.
Definition base64.hpp:129
std::string get()
get encoded string.
Definition base64.cpp:176
Encoder & operator=(const Encoder &other)=delete
copy assignment operator.
virtual ~Encoder()=default
destroy instance.
Encoderbuf _encoderbuf
associated encoder stream buffer.
Definition base64.hpp:175
Encoder(const Encoder &other)=delete
copy constructor.
Encoder()
default constructor.
Definition base64.cpp:145
encoder stream buffer.
Definition base64.hpp:60
virtual ~Encoderbuf()=default
destroy encoder stream buffer instance.
Encoderbuf & operator=(const Encoderbuf &other)=delete
copy assignment operator.
std::string get()
get encoded string.
Definition base64.cpp:75
Encoderbuf(const Encoderbuf &other)=delete
copy constructor.
virtual int_type overflow(int_type c=traits_type::eof()) override
writes characters to the associated output sequence from the put area.
Definition base64.cpp:99
std::string _out
output buffer.
Definition base64.hpp:122
EvpEncodeCtxPtr _encodectx
encode context.
Definition base64.hpp:119
Encoderbuf()
create encoder stream buffer instance.
Definition base64.cpp:41
static const std::streamsize _bufsize
internal buffer size.
Definition base64.hpp:113
std::unique_ptr< char[]> _buf
internal buffer.
Definition base64.hpp:116
Definition acceptor.hpp:32
std::vector< uint8_t > BytesArray
bytes array.
Definition base64.hpp:39
__inline__ std::string bin2hex(const BytesArray &bin)
convert bytes array to string.
Definition base64.hpp:46
std::unique_ptr< EVP_ENCODE_CTX, EvpEncodeCtxDelete > EvpEncodeCtxPtr
Definition openssl.hpp:118