poser
A C framework for POsix SERvices
Loading...
Searching...
No Matches
PSC_Base64 Class Reference

Encode and decode data using Base64. More...

#include <poser/core/base64.h>

Static Public Member Functions

size_t PSC_Base64_encodedLen (size_t size)
 Calculate Base64-encoded size.
 
size_t PSC_Base64_decodedSize (size_t len)
 Calculate Base64-decoded size.
 
void PSC_Base64_encodeTo (char *enc, const uint8_t *data, size_t size)
 Base64-encode data to a given buffer.
 
char * PSC_Base64_encode (const uint8_t *data, size_t size)
 Base64-encode data to a newly created string.
 
void PSC_Base64_decodeTo (uint8_t *data, const char *enc, size_t len)
 Base64-decode a string to a given buffer.
 
uint8_t * PSC_Base64_decode (const char *enc, size_t *size)
 Base64-decode a string to a newly allocated buffer.
 

Detailed Description

Encode and decode data using Base64.

Provides static methods to encode and decode binary data with Base64.

Member Function Documentation

◆ PSC_Base64_decode()

uint8_t * PSC_Base64_decode ( const char *  enc,
size_t *  size 
)
static

Base64-decode a string to a newly allocated buffer.

Parameters
encthe Base64-encoded string
sizeif not NULL, set this to the size of the decoded data
Returns
a newly allocated buffer containing the decoded data

◆ PSC_Base64_decodedSize()

size_t PSC_Base64_decodedSize ( size_t  len)
static

Calculate Base64-decoded size.

Parameters
lenthe length of a Base64-encoded string
Returns
the size of the decoded binary data

◆ PSC_Base64_decodeTo()

void PSC_Base64_decodeTo ( uint8_t *  data,
const char *  enc,
size_t  len 
)
static

Base64-decode a string to a given buffer.

Parameters
databuffer to write the decoded data to, must have enough room for the decoded size
encthe Base64-encoded string
lenthe length of the Base64-encoded string

◆ PSC_Base64_encode()

char * PSC_Base64_encode ( const uint8_t *  data,
size_t  size 
)
static

Base64-encode data to a newly created string.

Parameters
datathe binary data to encode
sizethe size of the binary data
Returns
a newly allocated Base64-encoded string

◆ PSC_Base64_encodedLen()

size_t PSC_Base64_encodedLen ( size_t  size)
static

Calculate Base64-encoded size.

Parameters
sizethe size of some binary data
Returns
the length of the Base64-encoded string

◆ PSC_Base64_encodeTo()

void PSC_Base64_encodeTo ( char *  enc,
const uint8_t *  data,
size_t  size 
)
static

Base64-encode data to a given buffer.

Parameters
encbuffer to write Base64-encoded string to, must have enough room for the encoded string length plus a NUL terminator
datathe binary data to encode
sizethe size of the binary data

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