S2OPC OPCUA Toolkit
|
SecretBuffer (mangled key) and ExposedBuffer (contiguous deciphered buffered) APIs. More...
#include <stdint.h>
Go to the source code of this file.
Typedefs | |
typedef struct SOPC_SecretBuffer | SOPC_SecretBuffer |
typedef uint8_t | SOPC_ExposedBuffer |
Functions | |
SOPC_SecretBuffer * | SOPC_SecretBuffer_NewFromExposedBuffer (const SOPC_ExposedBuffer *buf, uint32_t len) |
Creates a new SecretBuffer from an ExposedBuffer. More... | |
SOPC_SecretBuffer * | SOPC_SecretBuffer_NewFromFile (const char *path) |
Creates a new SecretBuffer from a file. More... | |
SOPC_SecretBuffer * | SOPC_SecretBuffer_New (uint32_t len) |
Creates a new empty SecretBuffer. More... | |
void | SOPC_SecretBuffer_DeleteClear (SOPC_SecretBuffer *sec) |
Clears the SecretBuffer from its secrets and frees it. More... | |
uint32_t | SOPC_SecretBuffer_GetLength (const SOPC_SecretBuffer *sec) |
Length of the SecretBuffer. More... | |
const SOPC_ExposedBuffer * | SOPC_SecretBuffer_Expose (const SOPC_SecretBuffer *sec) |
Creates a ExposedBuffer from a SecretBuffer. More... | |
void | SOPC_SecretBuffer_Unexpose (const SOPC_ExposedBuffer *buf, const SOPC_SecretBuffer *sec) |
Unexposes the buffer. More... | |
SOPC_ExposedBuffer * | SOPC_SecretBuffer_ExposeModify (SOPC_SecretBuffer *sec) |
Creates a ExposedBuffer from a SecretBuffer for modification. More... | |
void | SOPC_SecretBuffer_UnexposeModify (SOPC_ExposedBuffer *buf, SOPC_SecretBuffer *sec) |
Unexposes the buffer exposed for modification. More... | |
SecretBuffer (mangled key) and ExposedBuffer (contiguous deciphered buffered) APIs.
Sensitive information should be stored as SecretBuffer (e.g. crypto keys, nonces, initialisation vectors). The current implementation of the SecretBuffer is a contiguous buffer, but that could be changed without impact on the API.
typedef struct SOPC_SecretBuffer SOPC_SecretBuffer |
typedef uint8_t SOPC_ExposedBuffer |
SOPC_SecretBuffer* SOPC_SecretBuffer_NewFromExposedBuffer | ( | const SOPC_ExposedBuffer * | buf, |
uint32_t | len | ||
) |
Creates a new SecretBuffer from an ExposedBuffer.
Copies buf
, so it can be de-allocated after that call. This function does not clear the exposed secrets from buf
.
SecretBuffer shall be de-allocated with SOPC_SecretBuffer_DeleteClear().
buf | The ExposedBuffer. |
len | Number of bytes of the buffer. |
SOPC_SecretBuffer* SOPC_SecretBuffer_NewFromFile | ( | const char * | path | ) |
Creates a new SecretBuffer from a file.
path | The path to the file |
SOPC_SecretBuffer* SOPC_SecretBuffer_New | ( | uint32_t | len | ) |
Creates a new empty SecretBuffer.
len | Number of bytes of the buffer. |
void SOPC_SecretBuffer_DeleteClear | ( | SOPC_SecretBuffer * | sec | ) |
Clears the SecretBuffer from its secrets and frees it.
sec | The SecretBuffer to free. |
uint32_t SOPC_SecretBuffer_GetLength | ( | const SOPC_SecretBuffer * | sec | ) |
Length of the SecretBuffer.
const SOPC_ExposedBuffer* SOPC_SecretBuffer_Expose | ( | const SOPC_SecretBuffer * | sec | ) |
Creates a ExposedBuffer from a SecretBuffer.
Each call to _Expose shoud be followed by a call to SOPC_SecretBuffer_Unexpose().
sec
shall not be de-allocated before the call to SOPC_SecretBuffer_Unexpose(). sec | The SecretBuffer to expose. |
void SOPC_SecretBuffer_Unexpose | ( | const SOPC_ExposedBuffer * | buf, |
const SOPC_SecretBuffer * | sec | ||
) |
Unexposes the buffer.
buf | The ExposedBuffer |
sec | The SecretBuffer to store the data |
SOPC_ExposedBuffer* SOPC_SecretBuffer_ExposeModify | ( | SOPC_SecretBuffer * | sec | ) |
Creates a ExposedBuffer from a SecretBuffer for modification.
Each call to _Expose shoud be followed by a call to SOPC_SecretBuffer_Unexpose().
sec
shall not be de-allocated before the call to SOPC_SecretBuffer_Unexpose().sec | The SecretBuffer to expose. |
void SOPC_SecretBuffer_UnexposeModify | ( | SOPC_ExposedBuffer * | buf, |
SOPC_SecretBuffer * | sec | ||
) |
Unexposes the buffer exposed for modification.
buf | The ExposedBuffer |
sec | The SecretBuffer to store the data |