Base64 module header file. More...
#include "mcl_core/mcl_core_common.h"
Go to the source code of this file.
Functions | |
MCL_LOCAL mcl_error_t | base64_decode (const char *encoded_data, mcl_uint8_t **decoded_data, mcl_size_t *decoded_data_size) |
MCL_LOCAL mcl_error_t | base64_url_decode (const char *encoded_data, mcl_uint8_t **decoded_data, mcl_size_t *decoded_data_size) |
MCL_LOCAL mcl_error_t | base64_encode (const mcl_uint8_t *data, mcl_size_t data_size, char **encoded_data) |
MCL_LOCAL mcl_error_t | base64_url_encode (const mcl_uint8_t *data, mcl_size_t data_size, char **encoded_data) |
Base64 module header file.
This module defines methods for base64 and base64url encoding/decoding.
Definition in file base64.h.
MCL_LOCAL mcl_error_t base64_decode | ( | const char * | encoded_data, |
mcl_uint8_t ** | decoded_data, | ||
mcl_size_t * | decoded_data_size | ||
) |
This function is used for decoding a base64 encoded, zero-terminated string in encoded_data
and return decoded data in decoded_data
with size decoded_data_size
.
When decoded data length is 0, returns MCL_NULL in decoded_data
.
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. |
encoded_data
has invalid length (0 or not multiples of 4) or is invalidly encoded. Definition at line 93 of file base64.c.
References _decode_with_table(), base64_decode_table, MCL_DEBUG_ENTRY, and MCL_DEBUG_LEAVE.
Referenced by security_handler_base64_decode().
MCL_LOCAL mcl_error_t base64_encode | ( | const mcl_uint8_t * | data, |
mcl_size_t | data_size, | ||
char ** | encoded_data | ||
) |
This function is used for base64 encoding of data in data
and return encoded data in encoded_data
.
When encoded data length is 0, returns MCL_NULL in encoded_data
.
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. |
Definition at line 119 of file base64.c.
References _encode_with_table(), base64_encode_table, MCL_DEBUG_ENTRY, and MCL_DEBUG_LEAVE.
Referenced by security_handler_base64_encode().
MCL_LOCAL mcl_error_t base64_url_decode | ( | const char * | encoded_data, |
mcl_uint8_t ** | decoded_data, | ||
mcl_size_t * | decoded_data_size | ||
) |
This function is used for decoding a base64 URL encoded, zero-terminated string in encoded_data
and return decoded data in decoded_data
with size decoded_data_size
.
When decoded data length is 0, returns MCL_NULL in decoded_data
.
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 . |
encoded_data
has invalid length (0 or not multiples of 4) or is invalidly encoded. Definition at line 106 of file base64.c.
References _decode_with_table(), base64_url_decode_table, MCL_DEBUG_ENTRY, and MCL_DEBUG_LEAVE.
MCL_LOCAL mcl_error_t base64_url_encode | ( | const mcl_uint8_t * | data, |
mcl_size_t | data_size, | ||
char ** | encoded_data | ||
) |
This function is used for base64 URL encoding of data in data
and return encoded data in encoded_data
.
When encoded data length is 0, returns MCL_NULL in encoded_data
.
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. |
Definition at line 131 of file base64.c.
References _encode_with_table(), base64_url_encode_table, MCL_DEBUG_ENTRY, and MCL_DEBUG_LEAVE.
Referenced by _base64_encode_big_number(), and security_handler_base64_url_encode().