RTEMS 6.1-rc2
Loading...
Searching...
No Matches
Files | Data Structures | Enumerations | Functions | Variables
Base64 Encoding and Decoding

This group contains support functions for base64 and base64url encoding and decoding. More...

Files

file  base64-decode.c
 This source file contains the implementation of _Base64_Decode_initialize() and _Base64_Decode().
 
file  base64-encode.c
 This source file contains the implementation of _Base64_Encode() and _Base64url_Encode().
 
file  base64.h
 This header file provides the interfaces of the Base64 Encoding and Decoding.
 

Data Structures

struct  Base64_Decode_control
 Contains the base64 and base64url decoder control. More...
 

Enumerations

enum  Base64_Decode_state { BASE64_DECODE_STATE_0 , BASE64_DECODE_STATE_1 , BASE64_DECODE_STATE_2 , BASE64_DECODE_STATE_3 }
 Represents the base64 and base64url decoder state.
 
enum  Base64_Decode_status { BASE64_DECODE_SUCCESS , BASE64_DECODE_OVERFLOW , BASE64_DECODE_INVALID_INPUT }
 Represents the base64 and base64url decoder status.
 

Functions

int _Base64_Encode (IO_Put_char put_char, void *arg, const void *src, size_t len, const char *wordbreak, int wordlen)
 Outputs the source buffer in base64 encoding.
 
int _Base64url_Encode (IO_Put_char put_char, void *arg, const void *src, size_t len, const char *wordbreak, int wordlen)
 Outputs the source buffer in base64url encoding.
 
void _Base64_Decode_initialize (Base64_Decode_control *self, uint8_t *target, size_t target_size)
 Initializes the base64 decoder.
 
Base64_Decode_status _Base64_Decode (Base64_Decode_control *self, char ch)
 Decodes the character.
 

Variables

const uint8_t _Base64_Encoding [64]
 Maps a 6-bit integer to the corresponding base64 encoding.
 
const uint8_t _Base64url_Encoding [64]
 Maps a 6-bit integer to the corresponding base64url encoding.
 
const uint8_t _Base64_Decoding [128]
 Maps a 7-bit character to the associated 6-bit integer as defined by the base64 or base64url encoding or a special value.
 

Detailed Description

This group contains support functions for base64 and base64url encoding and decoding.

Function Documentation

◆ _Base64_Decode()

Base64_Decode_status _Base64_Decode ( Base64_Decode_control self,
char  ch 
)

Decodes the character.

The decoder accepts base64 and base64url encodings. White space is ignored.

Parameters
[in,out]selfis the base64 decoder control.
chis the character to decode.

◆ _Base64_Decode_initialize()

void _Base64_Decode_initialize ( Base64_Decode_control self,
uint8_t *  target,
size_t  target_size 
)

Initializes the base64 decoder.

Parameters
[out]selfis the base64 decoder control to initialize.
[out]targetis the base address of the target area for decoding.
target_sizeis the size in bytes of the target area for decoding.

◆ _Base64_Encode()

int _Base64_Encode ( IO_Put_char  put_char,
void *  arg,
const void *  src,
size_t  len,
const char *  wordbreak,
int  wordlen 
)

Outputs the source buffer in base64 encoding.

After word length of output characters produced by the encoding a word break is produced.

Parameters
put_charis the put character function used to output the encoded source buffer.
argis the argument passed to the put character function.
srcis the pointer to the source buffer begin.
srclenis the length of the source buffer in bytes.
wordbreakis the word break string.
wordlenis the word length in bytes. If the word length is less than four, then a word length of four will be used.
Returns
Returns the count of output characters.

◆ _Base64url_Encode()

int _Base64url_Encode ( IO_Put_char  put_char,
void *  arg,
const void *  src,
size_t  len,
const char *  wordbreak,
int  wordlen 
)

Outputs the source buffer in base64url encoding.

After word length of output characters produced by the encoding a word break is produced.

Parameters
put_charis the put character function used to output the encoded source buffer.
argis the argument passed to the put character function.
srcis the pointer to the source buffer begin.
srclenis the length of the source buffer in bytes.
wordbreakis the word break string.
wordlenis the word length in bytes. If the word length is less than four, then a word length of four will be used.
Returns
Returns the count of output characters.