Qsmtp  0.30dev
Functions
base64.h File Reference

headers of Base64 encode and decode functions More...

#include "sstring.h"

Go to the source code of this file.

Functions

int b64decode (const char *in, size_t l, string *out)
 
int b64encode (const string *in, string *out, const unsigned int wraplimit)
 

Detailed Description

headers of Base64 encode and decode functions

Function Documentation

int b64decode ( const char *  in,
size_t  l,
string out 
)

decode base64 string to plain text

Parameters
inbase64 text
llength of in
outstring to store decoded string (memory will be malloced)
Return values
<0negative error code
0on success
1on parse error

The contents of out are undefined as long as something else than 0 is returned, i.e. the memory is freed but the freed pointer may still be recorded in out.

A final 0-byte will always be added to out->s, which is not counted in out->len.

int b64encode ( const string in,
string out,
const unsigned int  wraplimit 
)

encode plain text string to Base64

Parameters
inplain text string
outstring to store Base64 string (memory will be malloced)
wraplimitthe number of characters after which a CRLF pair should be inserted
Return values
0on success
<0negative error code