BASE64(3)

NAME
base64, b64_ntop, b64_pton - base64 encode and decode

LIBRARY
libc

SYNOPSIS
#include <resolv.h>
int
b64_ntop(const unsigned char *src, size_t srclength, char *target, size_t targsize);
int
b64_pton(const char *src, unsigned char *target, size_t targsize);

DESCRIPTION
B64_ntop() encodes the input data src of length srclength, and writes the encoded string to target of capacity targsize. The output buffer target should be big enough to hold the encoded string, including the terminating NUL character. On success, target holds the encoded string and its length (without accounting for the NUL terminator) is returned. Otherwise, a value of -1 is returned.

B64_pton() decodes the base64 string src and writes the decoded data to target of capacity targsize. On success, target holds the decoded data and its length is returned. Otherwise, a value of -1 is returned. If the output buffer target is NULL, b64_pton() returns the required length to hold the decoded data.

RETURN VALUES
The base64 functions return the length of the result if successful; otherwise the value -1 is returned.

SEE ALSO
openssl(1) RFC, 1521, September 1993, MIME (Multipurpose Internet Mail Extensions) Part One.

HISTORY
The base64 functions appeared in FreeBSD 3.0.

AUTHORS
-nosplit This manual page was written by Aaron LI <aly@aaronly.me>.