#ifndef __APP_BASE64_H__
#define __APP_BASE64_H__


#define BASE64_INVALID_CHARACTER -2
#define BASE64_BUFFER_TOO_SMALL -1

#ifdef __cplusplus
extern "C"
{
#endif

/*
 * Decode a base64-formatted buffer
 */
int ch_base64_decode( unsigned char *dst, size_t *dlen,
                   const unsigned char *src, size_t slen );


/*
 * Encode a buffer into base64 format
 */
int ch_base64_encode( unsigned char *dst, size_t *dlen,
                   const unsigned char *src, size_t slen );

/*
 * Get output length
 */
size_t base64_len(size_t len);

#ifdef __cplusplus
}
#endif

#endif
