XBinder  Version 2.6.x
Functions
rtxBase64.h File Reference

base64 and base64url are defined in RFC 4648. More...

#include "rtxsrc/rtxContext.h"

Go to the source code of this file.

Functions

EXTERNRT long rtxBase64EncodeData (OSCTXT *pctxt, const char *pSrcData, size_t srcDataSize, OSOCTET **ppDstData)
 Encode binary data into base64 string form to a dynamic buffer. More...
 
EXTERNRT long rtxBase64EncodeURLParam (OSCTXT *pctxt, const char *pSrcData, size_t srcDataSize, OSOCTET **ppDstData)
 Encode binary data into base64 string form to a dynamic buffer, converting '+' characters to the URL escape sequence %2B so that the encoded string may be used in a query string parameter in a URL. More...
 
EXTERNRT long rtxBase64DecodeData (OSCTXT *pctxt, const char *pSrcData, size_t srcDataSize, OSOCTET **ppDstData)
 Decode base64 string to binary form into a dynamic buffer. More...
 
EXTERNRT long rtxBase64DecodeDataToFSB (OSCTXT *pctxt, const char *pSrcData, size_t srcDataSize, OSOCTET *buf, size_t bufsiz)
 Decode base64 string to binary form into a fixed-size buffer. More...
 
EXTERNRT long rtxBase64GetBinDataLen (const char *pSrcData, size_t srcDataSize)
 Calculate number of byte required to hold a decoded base64/base64url string in binary form. More...
 
EXTERNRT long rtxBase64UrlEncodeData (OSCTXT *pctxt, const char *pSrcData, size_t srcDataSize, OSOCTET **ppDstData)
 Encode binary data into base64url string form to a dynamic buffer. More...
 
EXTERNRT long rtxBase64UrlDecodeData (OSCTXT *pctxt, const char *pSrcData, size_t srcDataSize, OSOCTET **ppDstData)
 Decode base64url string to binary form into a dynamic buffer. More...
 
EXTERNRT long rtxBase64UrlDecodeDataToFSB (OSCTXT *pctxt, const char *pSrcData, size_t srcDataSize, OSOCTET *buf, size_t bufsiz)
 Decode base64url string to binary form into a fixed-size buffer. More...
 
EXTERNRT int rtxBase64CharToIdx (char c, OSBOOL url)
 Convert base64 character to index. More...
 
EXTERNRT char rtxBase64IdxToChar (int idx, OSBOOL url)
 Convert base64 index to character. More...
 

Detailed Description

base64 and base64url are defined in RFC 4648.

Definition in file rtxBase64.h.

Function Documentation

◆ rtxBase64CharToIdx()

EXTERNRT int rtxBase64CharToIdx ( char  c,
OSBOOL  url 
)

Convert base64 character to index.

Parameters
cCharacter to convert.
urlFlag indicating if base64 string is used in a URL
Returns
Converted integer value or -1 if invalid character.

◆ rtxBase64DecodeData()

EXTERNRT long rtxBase64DecodeData ( OSCTXT pctxt,
const char *  pSrcData,
size_t  srcDataSize,
OSOCTET **  ppDstData 
)

Decode base64 string to binary form into a dynamic buffer.

Parameters
pctxtPointer to context structure.
pSrcDataPointer to base64 string to decode.
srcDataSizeLength of the base64 string.
ppDstDataPointer to pointer variable to hold address of dynamically allocated buffer to hold data.
Returns
Completion status of operation:
  • number of binary bytes written
  • negative return value is error.

◆ rtxBase64DecodeDataToFSB()

EXTERNRT long rtxBase64DecodeDataToFSB ( OSCTXT pctxt,
const char *  pSrcData,
size_t  srcDataSize,
OSOCTET *  buf,
size_t  bufsiz 
)

Decode base64 string to binary form into a fixed-size buffer.

Parameters
pctxtPointer to context structure.
pSrcDataPointer to base64 string to decode.
srcDataSizeLength of the base64 string.
bufAddress of buffer to receive decoded binary data.
bufsizSize of output buffer.
Returns
Completion status of operation:
  • number of binary bytes written
  • negative return value is error.

◆ rtxBase64EncodeData()

EXTERNRT long rtxBase64EncodeData ( OSCTXT pctxt,
const char *  pSrcData,
size_t  srcDataSize,
OSOCTET **  ppDstData 
)

Encode binary data into base64 string form to a dynamic buffer.

Parameters
pctxtPointer to context structure.
pSrcDataPointer to binary data to encode.
srcDataSizeLength of the binary data in octets.
ppDstDataPointer to pointer variable to hold address of dynamically allocated buffer the encoded base64 string.
Returns
Completion status of operation:
  • number of binary bytes written
  • negative return value is error.

◆ rtxBase64EncodeURLParam()

EXTERNRT long rtxBase64EncodeURLParam ( OSCTXT pctxt,
const char *  pSrcData,
size_t  srcDataSize,
OSOCTET **  ppDstData 
)

Encode binary data into base64 string form to a dynamic buffer, converting '+' characters to the URL escape sequence %2B so that the encoded string may be used in a query string parameter in a URL.

Parameters
pctxtPointer to context structure.
pSrcDataPointer to binary data to encode.
srcDataSizeLength of the binary data in octets.
ppDstDataPointer to pointer variable to hold address of dynamically allocated buffer the encoded base64 string.
Returns
Completion status of operation:
  • number of binary bytes written
  • negative return value is error.

◆ rtxBase64GetBinDataLen()

EXTERNRT long rtxBase64GetBinDataLen ( const char *  pSrcData,
size_t  srcDataSize 
)

Calculate number of byte required to hold a decoded base64/base64url string in binary form.

Parameters
pSrcDataPointer to base64/base64url string.
srcDataSizeLength of the base64/base64url string.
Returns
Completion status of operation: If success, positive value is number of bytes, If failure, negative status code.

◆ rtxBase64IdxToChar()

EXTERNRT char rtxBase64IdxToChar ( int  idx,
OSBOOL  url 
)

Convert base64 index to character.

Parameters
idxIndex to convert.
urlFlag indicating if base64 string is used in a URL
Returns
Converted character value or -1 if invalid index;

◆ rtxBase64UrlDecodeData()

EXTERNRT long rtxBase64UrlDecodeData ( OSCTXT pctxt,
const char *  pSrcData,
size_t  srcDataSize,
OSOCTET **  ppDstData 
)

Decode base64url string to binary form into a dynamic buffer.

Parameters
pctxtPointer to context structure.
pSrcDataPointer to base64 string to decode.
srcDataSizeLength of the base64 string.
ppDstDataPointer to pointer variable to hold address of dynamically allocated buffer to hold data.
Returns
Completion status of operation:
  • number of binary bytes written
  • negative return value is error.

◆ rtxBase64UrlDecodeDataToFSB()

EXTERNRT long rtxBase64UrlDecodeDataToFSB ( OSCTXT pctxt,
const char *  pSrcData,
size_t  srcDataSize,
OSOCTET *  buf,
size_t  bufsiz 
)

Decode base64url string to binary form into a fixed-size buffer.

Parameters
pctxtPointer to context structure.
pSrcDataPointer to base64 string to decode.
srcDataSizeLength of the base64 string.
bufAddress of buffer to receive decoded binary data.
bufsizSize of output buffer.
Returns
Completion status of operation:
  • number of binary bytes written
  • negative return value is error.

◆ rtxBase64UrlEncodeData()

EXTERNRT long rtxBase64UrlEncodeData ( OSCTXT pctxt,
const char *  pSrcData,
size_t  srcDataSize,
OSOCTET **  ppDstData 
)

Encode binary data into base64url string form to a dynamic buffer.

Parameters
pctxtPointer to context structure.
pSrcDataPointer to binary data to encode.
srcDataSizeLength of the binary data in octets.
ppDstDataPointer to pointer variable to hold address of dynamically allocated buffer the encoded base64 string.
Returns
Completion status of operation:
  • number of binary bytes written
  • negative return value is error.