cctools
b64.h File Reference

Base64 Encoding Operations. More...

#include "buffer.h"
#include <stddef.h>

Go to the source code of this file.

Functions

int b64_encode (const void *blob, size_t bloblen, buffer_t *b64)
 Encode a binary blob in base64.
 
int b64_decode (const char *b64, buffer_t *blob)
 Decode a base64 encoded blob.
 

Detailed Description

Base64 Encoding Operations.

Function Documentation

◆ b64_encode()

int b64_encode ( const void * blob,
size_t bloblen,
buffer_t * b64 )

Encode a binary blob in base64.

The character array pointed to by b64 must have length of at least b64_size(bloblen).

Parameters
blobThe input binary blob.
bloblenThe input length of the binary blob.
b64The output base64 encoded blob.
Returns
0 on success, -1+errno on error.

◆ b64_decode()

int b64_decode ( const char * b64,
buffer_t * blob )

Decode a base64 encoded blob.

The character array pointed to by b64 must have length of at least b64_size(bloblen).

Parameters
b64The input base64 encoded blob.
blobThe output binary blob.
Returns
0 on success, -1+errno on error.