Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of azure_c_shared_utility by
base64.h File Reference
Prototypes for functions related to encoding/decoding a buffer
using standard base64 encoding.
More...
Go to the source code of this file.
Functions | |
MOCKABLE_FUNCTION (, STRING_HANDLE, Base64_Encoder, BUFFER_HANDLE, input) | |
Base64 encodes a buffer and returns the resulting string. | |
MOCKABLE_FUNCTION (, STRING_HANDLE, Base64_Encode_Bytes, const unsigned char *, source, size_t, size) | |
Base64 encodes the buffer pointed to by source and returns the resulting string. | |
MOCKABLE_FUNCTION (, BUFFER_HANDLE, Base64_Decoder, const char *, source) | |
Base64 decodes the buffer pointed to by source and returns the resulting buffer. |
Detailed Description
Prototypes for functions related to encoding/decoding a buffer
using standard base64 encoding.
Definition in file base64.h.
Function Documentation
MOCKABLE_FUNCTION | ( | STRING_HANDLE | , |
Base64_Encoder | , | ||
BUFFER_HANDLE | , | ||
input | |||
) |
Base64 encodes a buffer and returns the resulting string.
- Parameters:
-
input The buffer that needs to be base64 encoded.
Base64_Encoder takes as a parameter a pointer to a BUFFER. If input
is NULL
then Base64_Encoder
returns NULL
. The size of the BUFFER pointed to by input
may be zero. If when allocating memory to produce the encoding a failure occurs, then Base64_Encoder
returns NULL
. Otherwise Base64_Encoder
returns a pointer to a STRING. That string contains the base 64 encoding of the input
. This encoding of input
will not contain embedded line feeds.
- Returns:
- A
STRING_HANDLE
containing the base64 encoding ofinput
.
MOCKABLE_FUNCTION | ( | BUFFER_HANDLE | , |
Base64_Decoder | , | ||
const char * | , | ||
source | |||
) |
Base64 decodes the buffer pointed to by source
and returns the resulting buffer.
- Parameters:
-
source A base64 encoded string buffer.
This function decodes the string pointed at by source
using base64 decoding and returns the resulting buffer. If source
is NULL
then Base64_Decoder
returns NULL. If the string pointed to by source
is zero length then the handle returned refers to a zero length buffer. If there is any memory allocation failure during the decode or if the source string has an invalid length for a base 64 encoded string then Base64_Decoder
returns NULL
.
- Returns:
- A
BUFFER_HANDLE
pointing to a buffer containing the result of base64 decodingsource
.
MOCKABLE_FUNCTION | ( | STRING_HANDLE | , |
Base64_Encode_Bytes | , | ||
const unsigned char * | , | ||
source | , | ||
size_t | , | ||
size | |||
) |
Base64 encodes the buffer pointed to by source
and returns the resulting string.
- Parameters:
-
source The buffer that needs to be base64 encoded. size The size.
This function produces a STRING_HANDLE
containing the base64 encoding of the buffer pointed to by source
, having the size as given by size
. If source
is NULL
then Base64_Encode_Bytes
returns NULL
If source
is not NULL
and size
is zero, then Base64_Encode_Bytes
produces an empty STRING_HANDLE
. Otherwise, Base64_Encode_Bytes
produces a STRING_HANDLE
containing the Base64 representation of the buffer. In case of any errors, Base64_Encode_Bytes
returns NULL
.].
- Returns:
NULL
in case an error occurs or aSTRING_HANDLE
containing the base64 encoding ofinput
.
Generated on Tue Jul 12 2022 19:14:38 by
