gsasl  2.2.1
Functions
base64.c File Reference
#include <config.h>
#include "internal.h"
#include "base64.h"
#include "mechtools.h"

Go to the source code of this file.

Functions

int gsasl_base64_to (const char *in, size_t inlen, char **out, size_t *outlen)
 
int gsasl_base64_from (const char *in, size_t inlen, char **out, size_t *outlen)
 
int gsasl_hex_to (const char *in, size_t inlen, char **out, size_t *outlen)
 
int gsasl_hex_from (const char *in, char **out, size_t *outlen)
 

Function Documentation

◆ gsasl_base64_from()

int gsasl_base64_from ( const char *  in,
size_t  inlen,
char **  out,
size_t *  outlen 
)

gsasl_base64_from:

Parameters
ininput byte array
inlensize of input byte array
outpointer to newly allocated output byte array
outlenpointer to size of newly allocated output byte array

Decode Base64 data. The @out buffer must be deallocated by the caller.

Return value: Returns GSASL_OK on success, GSASL_BASE64_ERROR if input was invalid, and GSASL_MALLOC_ERROR on memory allocation errors.

Since: 0.2.2

Definition at line 75 of file base64.c.

◆ gsasl_base64_to()

int gsasl_base64_to ( const char *  in,
size_t  inlen,
char **  out,
size_t *  outlen 
)

gsasl_base64_to:

Parameters
ininput byte array.
inlensize of input byte array.
outpointer to newly allocated base64-encoded string.
outlenpointer to size of newly allocated base64-encoded string.

Encode data as base64. The @out string is zero terminated, and @outlen holds the length excluding the terminating zero. The @out buffer must be deallocated by the caller.

Return value: Returns GSASL_OK on success, or GSASL_MALLOC_ERROR if input was too large or memory allocation fail.

Since: 0.2.2

Definition at line 45 of file base64.c.

◆ gsasl_hex_from()

int gsasl_hex_from ( const char *  in,
char **  out,
size_t *  outlen 
)

gsasl_hex_from:

Parameters
ininput byte array
outpointer to newly allocated output byte array
outlenpointer to size of newly allocated output byte array

Decode hex data. The @out buffer must be deallocated by the caller.

Return value: Returns GSASL_OK on success, GSASL_BASE64_ERROR if input was invalid, and GSASL_MALLOC_ERROR on memory allocation errors.

Since: 1.10

Definition at line 144 of file base64.c.

◆ gsasl_hex_to()

int gsasl_hex_to ( const char *  in,
size_t  inlen,
char **  out,
size_t *  outlen 
)

gsasl_hex_to:

Parameters
ininput byte array.
inlensize of input byte array.
outpointer to newly allocated hex-encoded string.
outlenpointer to size of newly allocated hex-encoded string.

Hex encode data. The @out string is zero terminated, and @outlen holds the length excluding the terminating zero. The @out buffer must be deallocated by the caller.

Return value: Returns GSASL_OK on success, or GSASL_MALLOC_ERROR if input was too large or memory allocation fail.

Since: 1.10

Definition at line 111 of file base64.c.