Coconut Framework  beta
Functions
CNBase64.h File Reference

Define function to encode/decode base64 data. More...

#include "CNBuffer.h"
#include "CNForwarders.h"
#include <string.h>

Go to the source code of this file.

Functions

struct CNBuffer CNEncodeDataToBase64 (size_t size, const void *data)
 Encode binary data into base64. More...
 
struct CNBuffer CNDecodeDataFromBase64 (size_t len, const void *data)
 Decode base64 string into data. More...
 

Detailed Description

Define function to encode/decode base64 data.

Copyright
Copyright (C) 2012 Steel Wheels Project
Reference
http://en.wikipedia.org/wiki/Base64

Function Documentation

struct CNBuffer CNEncodeDataToBase64 ( size_t  size,
const void *  data 
)

Encode binary data into base64.

Returns
The buffer which contains base64 text
Parameters
sizeSize of source data
dataSource data
Note
The encoded string DOES NOT contain newline/spaces.
Warning
You have to deallocate returned buffer by CNDestroyBuffer() function
struct CNBuffer CNDecodeDataFromBase64 ( size_t  len,
const void *  data 
)

Decode base64 string into data.

Returns
The buffer which contains decoded data
Parameters
lenLength of source string
dataSource string
Note
The source string must contains only base64 text. Remove spaces in source text becofe calling this function.
Warning
You have to deallocate returned buffer by CNDestroyBuffer() function