le_base64.h File Reference

Go to the source code of this file.

Macros

#define LE_BASE64_ENCODED_SIZE(x)   (4 * ((x + 2) / 3))
 

Functions

le_result_t le_base64_Encode (const uint8_t *dataPtr, size_t dataLength, char *resultPtr, size_t *resultSizePtr)
 
le_result_t le_base64_Decode (const char *srcPtr, size_t srcLen, uint8_t *dstPtr, size_t *dstLenPtr)
 

Detailed Description

Legato Base64 encoding/decoding API include file.

Macro Definition Documentation

◆ LE_BASE64_ENCODED_SIZE

#define LE_BASE64_ENCODED_SIZE (   x)    (4 * ((x + 2) / 3))

Calculate the encoded string length (including padding, not including terminating zero) for a given binary data size.

Function Documentation

◆ le_base64_Decode()

le_result_t le_base64_Decode ( const char *  srcPtr,
size_t  srcLen,
uint8_t *  dstPtr,
size_t *  dstLenPtr 
)

Decode base64-encoded data.

Returns
  • LE_OK if succeeds
  • LE_BAD_PARAMETER if NULL pointer provided
  • LE_FORMAT_ERROR if data contains invalid (non-base64) characters
  • LE_OVERFLOW if provided buffer is not large enough
Parameters
[in]srcPtrEncoded string
[in]srcLenEncoded string length
[out]dstPtrBinary data buffer
[in,out]dstLenPtrBinary data buffer size / decoded data size

◆ le_base64_Encode()

le_result_t le_base64_Encode ( const uint8_t *  dataPtr,
size_t  dataLength,
char *  resultPtr,
size_t *  resultSizePtr 
)

Perform base64 data encoding.

Returns
  • LE_OK if succeeds
  • LE_BAD_PARAMETER if NULL pointer provided
  • LE_OVERFLOW if provided buffer is not large enough
Parameters
[in]dataPtrData to be encoded
[in]dataLengthData length
[out]resultPtrBase64-encoded string buffer
[in,out]resultSizePtrLength of the base64-encoded string buffer