High Performance OPC UA Server SDK  1.2.0.193
base64

Base64 conversion. More...

Functions

int util_base64_encode (const unsigned char *src, int slen, char *dst, int dlen)
 Converts the bytestring src into the base64 string dst. More...
 
int util_base64_decode (const char *src, int slen, unsigned char *dst, int dlen)
 Decodes the string src from base64 into the bytestring dst. More...
 
int util_base64_decode_verify (const char *src, int slen)
 Verfies sanity of the base64 string src and calculates the size, a buffer would need for the decoded bytes. More...
 
int util_base64_decode_unchecked (const char *src, int slen, unsigned char *dst, int dlen)
 Decodes the string src from base64 into the bytestring dst. More...
 

Detailed Description

Base64 conversion.

Function Documentation

int util_base64_decode ( const char *  src,
int  slen,
unsigned char *  dst,
int  dlen 
)

Decodes the string src from base64 into the bytestring dst.

Parameters
srcBase64 encoded string. May contain whitespaces.
slenlength of the string src.
dstpreallocated buffer to write bytestring to.
dlensize of the buffer dst in bytes.
Returns
Returns the number of bytes written to dst. If dst is NULL and dlen is 0 the required size of the buffer will be returned. If dst is to small for writing the complete base64 encoded string, the number of actually written bytes is returned. Returns -1 if src is malformed.
int util_base64_decode_unchecked ( const char *  src,
int  slen,
unsigned char *  dst,
int  dlen 
)

Decodes the string src from base64 into the bytestring dst.

Does not check sanity of src before decoding.

Parameters
srcBase64 encoded string. May contain whitespaces.
slenlength of the string src.
dstpreallocated buffer to write bytestring to.
dlensize of the buffer dst in bytes.
Returns
Returns the number of bytes written to dst. If dst is too small for writing the complete base64 encoded string, the number of actually written bytes is returned. If decoding fails -1 is returned.
int util_base64_decode_verify ( const char *  src,
int  slen 
)

Verfies sanity of the base64 string src and calculates the size, a buffer would need for the decoded bytes.

Parameters
srcBase64 encoded string
slenLenght of src
Returns
Returns -1 if the string is malformed. On success the number of bytes a buffer would need to hold the completely decoded string are returned.
int util_base64_encode ( const unsigned char *  src,
int  slen,
char *  dst,
int  dlen 
)

Converts the bytestring src into the base64 string dst.

Parameters
srcbyte array to encode to base64.
slenlength of src in bytes.
dstpreallocated buffer to write base64 string to.
dlensize of dst buffer in bytes. This function writes at most dlen-1 characters to dst and always adds a null byte.
Returns
Returns the number of bytes that have been written or would be written (excluding the terminating null byte) to dst. If dst is too small for writing the complete base64 encoded string, a truncated but still valid base64 string will be written. If dst is NULL and dlen is 0 the size of the buffer dst (excluding the terminating null byte) that is required to write the complete base64 string will be returned.