NetBurner 3.5.0
PDF Version
 
Base64

Functions

int Base64Decode (const char *input, uint8_t *outputbuf, const char *pEndMarker=NULL)
 Decodes a null terminated Base64 string into bytes.
 
int Base64UrlDecode (const char *input, uint8_t *outputbuf, const char *pEndMarker=NULL)
 Decodes a null terminated Base64Url string into bytes.
 
int Base64Encode (uint8_t *input, int inlen, char *outputbuf)
 Encodes arbitrary binary bytes into Base64 string.
 
int Base64UrlEncode (uint8_t *input, int inlen, char *outputbuf)
 Encodes arbitrary binary bytes into Base64Url string.
 
int Base64StreamEncode (int fd, uint8_t *input, int inlen, char *outBuf, int maxOutLen)
 Encodes arbitrary binary bytes into Base64 string and writes them to a file descriptor.
 
int Base64UrlStreamEncode (int fd, uint8_t *input, int inlen, char *outBuf, int maxOutLen)
 Encodes arbitrary binary bytes into Base64Url string and writes them to a file descriptor.
 

Detailed Description

#include< base64.h >

Functions to encode/decode in Base64

Function Documentation

◆ Base64Decode()

int Base64Decode ( const char * input,
uint8_t * outputbuf,
const char * pEndMarker = NULL )

#include <base64.h>

Decodes a null terminated Base64 string into bytes.

Notes:

  • outputbuf should be at least the size of input divided by 4, rounded up
  • Does not null terminate results
Parameters
inputBase64 string
outputbufResulting decoded data
pEndMarkerPointer to the end of the string (in the event it is not terminated by by either a null char or a base64 terminator)
Returns
Number of bytes returned in outputbuf
See also
Base64Encode()
Base64UrlDecode()

◆ Base64Encode()

int Base64Encode ( uint8_t * input,
int inlen,
char * outputbuf )

#include <base64.h>

Encodes arbitrary binary bytes into Base64 string.

Notes: Does not null terminate results but terminates with an '='

Parameters
inputData
inlenLength of data
outputbufResulting encoded data
Returns
Number of bytes returned in outputbuf
See also
Base64Decode()
Base64StreamEncode()
Base64UrlEncode()

◆ Base64StreamEncode()

int Base64StreamEncode ( int fd,
uint8_t * input,
int inlen,
char * outBuf,
int maxOutLen )

#include <base64.h>

Encodes arbitrary binary bytes into Base64 string and writes them to a file descriptor.

Notes: Does not null terminate results but terminates with an '='

Parameters
fdTarget File Descriptor
inputData to be encoded
inlenLength of data
outBufTemporary buffer to accumulate encoded data
maxOutLenMaximum buffer space to accumulate data
Returns
Number of bytes returned in outputbuf
See also
Base64Encode
Base64UrlStreamEncode

◆ Base64UrlDecode()

int Base64UrlDecode ( const char * input,
uint8_t * outputbuf,
const char * pEndMarker = NULL )

#include <base64.h>

Decodes a null terminated Base64Url string into bytes.

Notes:

  • outputbuf should be at least the size of input divided by 4, rounded up
  • Does not null terminate results
Parameters
inputBase64Url string
outputbufResulting decoded data
pEndMarkerPointer to the end of the string (in the event it is not terminated by by either a null char or a base64 terminator)
Returns
Number of bytes returned in outputbuf
See also
Base64UrlEncode()
Base64Decode()

◆ Base64UrlEncode()

int Base64UrlEncode ( uint8_t * input,
int inlen,
char * outputbuf )

#include <base64.h>

Encodes arbitrary binary bytes into Base64Url string.

Notes: Does not null terminate results but terminates with an '='

Parameters
inputData
inlenLength of data
outputbufResulting encoded data
Returns
Number of bytes returned in outputbuf
See also
Base64UrlDecode()
Base64UrlStreamEncode()
Base64Encode()

◆ Base64UrlStreamEncode()

int Base64UrlStreamEncode ( int fd,
uint8_t * input,
int inlen,
char * outBuf,
int maxOutLen )

#include <base64.h>

Encodes arbitrary binary bytes into Base64Url string and writes them to a file descriptor.

Notes: Does not null terminate results but terminates with an '='

Parameters
fdTarget File Descriptor
inputData to be encoded
inlenLength of data
outBufTemporary buffer to accumulate encoded data
maxOutLenMaximum buffer space to accumulate data
Returns
Number of bytes returned in outputbuf
See also
Base64UrlEncode
Base64StreamEncode