Encodings

## Functions

char * | xmpp_base64_encode (xmpp_ctx_t *ctx, const unsigned char *data, size_t len)
| Base64 encoding routine.
char * | xmpp_base64_decode_str (xmpp_ctx_t *ctx, const char *base64, size_t len)
| Base64 decoding routine.
void | xmpp_base64_decode_bin (xmpp_ctx_t *ctx, const char *base64, size_t len, unsigned char **out, size_t *outlen)
| Base64 decoding routine.

## Detailed Description

## Function Documentation

## xmpp_base64_encode()

char * xmpp_base64_encode | ( | xmpp_ctx_t * | ctx,
|  | const unsigned char * | data,
|  | size_t | len )

Base64 encoding routine.

Returns an allocated string which must be freed with xmpp_free().

Parameters

  ctx | a Strophe context
  data | buffer to encode
  len | size of the data buffer

Returns
  an allocated null-terminated string or NULL on error

## xmpp_base64_decode_str()

char * xmpp_base64_decode_str | ( | xmpp_ctx_t * | ctx,
|  | const char * | base64,
|  | size_t | len )

Base64 decoding routine.

Returns an allocated string which must be freed with xmpp_free(). User calls this function when the result must be a string. When decoded buffer contains '\0' NULL is returned.

Parameters

  ctx | a Strophe context
  base64 | encoded buffer
  len | size of the buffer

Returns
  an allocated null-terminated string or NULL on error

## xmpp_base64_decode_bin()

void xmpp_base64_decode_bin | ( | xmpp_ctx_t * | ctx,
|  | const char * | base64,
|  | size_t | len,
|  | unsigned char ** | out,
|  | size_t * | outlen )

Base64 decoding routine.

Returns an allocated buffer which must be freed with xmpp_free().

Parameters

  ctx | a Strophe context
  base64 | encoded buffer
  len | size of the encoded buffer
  out | allocated buffer is stored here
  outlen | size of the allocated buffer

Note
  on an error the *out will be NULL