Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Base64

Base64 encoding/decoding functions More...

Functions

int base64_encode (uint8_t *dst, size_t dlen, size_t *olen, const uint8_t *src, size_t slen)
 Encode a buffer into base64 format.
 
int base64_decode (uint8_t *dst, size_t dlen, size_t *olen, const uint8_t *src, size_t slen)
 Decode a base64-formatted buffer.
 

Detailed Description

Base64 encoding/decoding functions

Function Documentation

◆ base64_decode()

int base64_decode ( uint8_t * dst,
size_t dlen,
size_t * olen,
const uint8_t * src,
size_t slen )

#include <zephyr/sys/base64.h>

Decode a base64-formatted buffer.

Parameters
dstdestination buffer (can be NULL for checking size)
dlensize of the destination buffer
olennumber of bytes written
srcsource buffer
slenamount of data to be decoded
Returns
0 if successful, -ENOMEM, or -EINVAL if the input data is not correct. *olen is always updated to reflect the amount of data that has (or would have) been written.
Note
Call this function with *dst = NULL or dlen = 0 to obtain the required buffer size in *olen

◆ base64_encode()

int base64_encode ( uint8_t * dst,
size_t dlen,
size_t * olen,
const uint8_t * src,
size_t slen )

#include <zephyr/sys/base64.h>

Encode a buffer into base64 format.

Parameters
dstdestination buffer
dlensize of the destination buffer
olennumber of bytes written
srcsource buffer
slenamount of data to be encoded
Returns
0 if successful, or -ENOMEM if the buffer is too small. *olen is always updated to reflect the amount of data that has (or would have) been written. If that length cannot be represented, then no data is written to the buffer and *olen is set to the maximum length representable as a size_t.
Note
Call this function with dlen = 0 to obtain the required buffer size in *olen