base64.h File Reference

Base64 module header file. More...

#include "string_type.h"
Include dependency graph for base64.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

E_MCL_ERROR_CODE base64_decode (const string_t *encoded_data, mcl_uint8_t **decoded_data, mcl_size_t *decoded_data_size)
 
E_MCL_ERROR_CODE base64_url_decode (const string_t *encoded_data, mcl_uint8_t **decoded_data, mcl_size_t *decoded_data_size)
 
E_MCL_ERROR_CODE base64_encode (const mcl_uint8_t *data, mcl_size_t data_size, string_t **encoded_data)
 
E_MCL_ERROR_CODE base64_url_encode (const mcl_uint8_t *data, mcl_size_t data_size, string_t **encoded_data)
 

Detailed Description

Base64 module header file.


Date
Aug 5, 2016 This module defines methods to calculate encoding, decoding, base64 and base64url for given data.

Definition in file base64.h.

Function Documentation

E_MCL_ERROR_CODE base64_decode ( const string_t encoded_data,
mcl_uint8_t **  decoded_data,
mcl_size_t decoded_data_size 
)

Given a base64 zero-terminated string at encoded_data, decode it and return a pointer in decoded_data to a newly allocated memory area holding decoded data. Size of decoded data is returned in variable pointed by decoded_data_size.

When decoded data length is 0, returns MCL_NULL in decoded_data.

Parameters
encoded_data[in] Zero-terminated string which is base64 encoded and has to be decoded.
decoded_data[out] Newly allocated memory holding decoded data.
decoded_data_size[out] Size of decoded data.
Returns
  • MCL_OK in case of success.
  • MCL_OUT_OF_MEMORY in case there is not enough memory in the system to proceed.
  • MCL_BAD_CONTENT_ENCODING if provided encoded_data has invalid length (0 or not multiples of 4) or if the given encoded_data is invalidly encoded.

Definition at line 82 of file base64.c.

References _decode_with_table(), base64_decode_table, DEBUG_ENTRY, and DEBUG_LEAVE.

Referenced by security_handler_base64_decode().

Here is the call graph for this function:

Here is the caller graph for this function:

E_MCL_ERROR_CODE base64_encode ( const mcl_uint8_t data,
mcl_size_t  data_size,
string_t **  encoded_data 
)

Given a pointer to an input data and an input size, encode it with base64 and return a pointer in encoded_data to a newly allocated string area holding encoded data. Length of encoded data is also returned.

When encoded data length is 0, returns MCL_NULL in encoded_data.

Parameters
data[in] Input data that has to be base64 encoded.
data_size[in] Size of given input data.
encoded_data[out] Newly allocated string holding encoded data and its length.
Returns

Definition at line 102 of file base64.c.

References _encode_with_table(), base64_encode_table, DEBUG_ENTRY, and DEBUG_LEAVE.

Referenced by security_handler_base64_encode().

Here is the call graph for this function:

Here is the caller graph for this function:

E_MCL_ERROR_CODE base64_url_decode ( const string_t encoded_data,
mcl_uint8_t **  decoded_data,
mcl_size_t decoded_data_size 
)

Given a base64 URL zero-terminated string at encoded_data, decode it and return a pointer in decoded_data to a newly allocated memory area holding decoded data. Size of decoded data is returned in variable pointed by decoded_data_size.

When decoded data length is 0, returns MCL_NULL in decoded_data.

Parameters
encoded_data[in] Zero-terminated string which is base64 URL encoded and has to be decoded.
decoded_data[out] Newly allocated memory holding decoded data.
decoded_data_size[out] Size of decoded_data.
Returns
  • MCL_OK in case of success.
  • MCL_OUT_OF_MEMORY in case there is not enough memory in the system to proceed.
  • MCL_BAD_CONTENT_ENCODING if provided encoded_data has invalid length (0 or not multiples of 4) or if the given encoded_data is invalidly encoded.

Definition at line 92 of file base64.c.

References _decode_with_table(), base64_url_decode_table, DEBUG_ENTRY, and DEBUG_LEAVE.

Here is the call graph for this function:

E_MCL_ERROR_CODE base64_url_encode ( const mcl_uint8_t data,
mcl_size_t  data_size,
string_t **  encoded_data 
)

Given a pointer to an input data and an input size, encode it with base64 URL and return a pointer in encoded_data to a newly allocated string area holding encoded data. Length of encoded data is also returned.

When encoded data length is 0, returns MCL_NULL in encoded_data.

Parameters
data[in] Input data that has to be base64 URL encoded.
data_size[in] Size of given input data.
encoded_data[out] Newly allocated string holding encoded data and its length.
Returns

Definition at line 112 of file base64.c.

References _encode_with_table(), base64_url_encode_table, DEBUG_ENTRY, and DEBUG_LEAVE.

Referenced by _base64_encode_big_number(), and security_handler_base64_url_encode().

Here is the call graph for this function:

Here is the caller graph for this function: