C Porting Layer API Reference for Oracle Internet of Things Cloud Service Client Software Library. Release 21.1.1.0.0-3. E80003-19
iotcs_port_crypto.h File Reference

The file contains porting layer for cryptography. More...

#include "iotcs.h"

Go to the source code of this file.

Defines

#define IOTCS_MD5_DIGEST_LENGTH   32

Typedefs

typedef const char *(* iotcs_port_get_next_string_func )(void *)
 Handler for function used in iotcs_port_md5 method.
typedef const char *(* iotcs_port_get_next_chunk_func )(void *, int *)

Functions

iotcs_result iotcs_port_crypto_encode_base64 (char *output, size_t *output_length, const char *input, size_t input_length)
 Encodes the input buffer and writes the result to output buffer.
iotcs_result iotcs_port_crypto_decode_base64 (char *output, size_t *output_length, const char *input, size_t input_length)
 Decodes the input buffer and writes the result to output buffer.
iotcs_result iotcs_port_crypto_init (void)
 Initializes cryptography related functionality.
void iotcs_port_crypto_finalize (void)
 Finalizes cryptography related functionality.
iotcs_result iotcs_port_md5 (unsigned char *output_buffer, iotcs_port_get_next_string_func func, void *data)
 Computes MD5 message digest Calculate MD5 digest for NULL-terminated strings returned by func(data) where func and data are given as arguments.
iotcs_result iotcs_port_md5_file (unsigned char *output_buffer, iotcs_port_get_next_chunk_func func, void *data)
 Computes MD5 message digest Calculate MD5 digest for NULL-terminated strings returned by func(data) where func and data are given as arguments.

Detailed Description

The file contains porting layer for cryptography.


Function Documentation

iotcs_result iotcs_port_crypto_decode_base64 ( char *  output,
size_t *  output_length,
const char *  input,
size_t  input_length 
)

Decodes the input buffer and writes the result to output buffer.

Note:
Mandatory API. Called by the Library in any configuration.
Parameters:
outputan output buffer
output_lengthIN : length of the output buffer OUT : number of bytes written to the output buffer
inputan input buffer
input_lengtha length of the input buffer
Returns:
IOTCS_RESULT_OK success
IOTCS_RESULT_FAIL otherwise
iotcs_result iotcs_port_crypto_encode_base64 ( char *  output,
size_t *  output_length,
const char *  input,
size_t  input_length 
)

Encodes the input buffer and writes the result to output buffer.

Note:
Mandatory API. Called by the Library in any configuration.
Parameters:
outputan output buffer
output_lengthIN : length of the output buffer OUT : number of bytes written to the output buffer
inputan input buffer
input_lengtha length of the input buffer
Returns:
IOTCS_RESULT_OK success
IOTCS_RESULT_FAIL otherwise
void iotcs_port_crypto_finalize ( void  )

Finalizes cryptography related functionality.

Note:
Mandatory API. Called by the Library in any configuration.
iotcs_result iotcs_port_crypto_init ( void  )

Initializes cryptography related functionality.

Note:
Mandatory API. Called by the Library in any configuration.
Returns:
IOTCS_RESULT_OK success
IOTCS_RESULT_FAIL otherwise
iotcs_result iotcs_port_md5 ( unsigned char *  output_buffer,
iotcs_port_get_next_string_func  func,
void *  data 
)

Computes MD5 message digest Calculate MD5 digest for NULL-terminated strings returned by func(data) where func and data are given as arguments.

Calculation stops when func(data) returns NULL. The calculated MD5 digest is saved to output_buffer which is guaranteed to be at least IOTCS_MD5_DIGEST_LENGTH bytes in size.

Note:
Mandatory API. Called by the Library in any configuration.
Parameters:
output_bufferbuffer to write output which size is IOTCS_MD5_DIGEST_LENGTH bytes
funca function that provides strings for MD5 from data container
datato be passed to 'func' as an argument
Returns:
IOTCS_RESULT_OK success
IOTCS_RESULT_FAIL otherwise
iotcs_result iotcs_port_md5_file ( unsigned char *  output_buffer,
iotcs_port_get_next_chunk_func  func,
void *  data 
)

Computes MD5 message digest Calculate MD5 digest for NULL-terminated strings returned by func(data) where func and data are given as arguments.

Calculation stops when func(data) returns NULL. The calculated MD5 digest is saved to output_buffer which is guaranteed to be at least IOTCS_MD5_DIGEST_LENGTH bytes in size.

Note:
Mandatory API. Called by the Library in any configuration.
Parameters:
output_bufferbuffer to write output which size is IOTCS_MD5_DIGEST_LENGTH bytes
funca function that provides strings for MD5 from data container
datato be passed to 'func' as an argument
Returns:
IOTCS_RESULT_OK success
IOTCS_RESULT_FAIL otherwise