TCPIP_Helper_Base64Decode Function

C

uint16_t TCPIP_Helper_Base64Decode(
    const uint8_t* sourceData, 
    uint16_t sourceLen, 
    uint8_t* destData, 
    uint16_t destLen
);

Description

Decodes a base-64 array to its literal representation.

Preconditions

sourceData, destData - valid pointers.

Parameters

ParametersDescription
sourceDataPointer to a string of base-64 encoded data.
sourceLenLength of the base-64 source data. Maximum length that can be written to destData.
destDataPointer to write the decoded data.

Returns

  • Number of decoded bytes written to destData.

Remarks

This function will ignore invalid base-64 characters (CR, LF, etc). If sourceData is equal to destData, the data will be converted in-place. If sourceData is not equal to destData, but the regions overlap, the behavior is undefined. Decoded data size is 3/4 the size of the encoded source data.