S2OPC OPCUA Toolkit
Loading...
Searching...
No Matches
sopc_crypto_provider_lib_itf.h File Reference

Defines the cryptographic abstraction interface for the SOPC_CryptoProvider. A cryptographic implementation must define all the functions declared in this file. More...

#include "sopc_crypto_decl.h"
#include "sopc_enums.h"

Go to the source code of this file.

Functions

SOPC_ReturnStatus SOPC_CryptoProvider_Init (SOPC_CryptoProvider *pCryptoProvider)
 Initializes a SOPC_CryptoProvider context. Called by SOPC_CryptoProvider_Create() upon context creation.
 
SOPC_ReturnStatus SOPC_CryptoProvider_Deinit (SOPC_CryptoProvider *pCryptoProvider)
 Deinitialize a SOPC_CryptoProvider context (this process is specific to the chosen cryptographic library). Called by SOPC_CryptoProvider_Free() upon context destruction.
 
SOPC_ReturnStatus SOPC_CryptoProvider_AsymmetricGetLength_KeyBits (const SOPC_CryptoProvider *pProvider, const SOPC_AsymmetricKey *pKey, uint32_t *pLenKeyBits)
 Writes the length in bits in pLenKeyBits of the asymmetric key pKey.
 
SOPC_ReturnStatus SOPC_CryptoProvider_AsymmetricGetLength_MsgPlainText (const SOPC_CryptoProvider *pProvider, const SOPC_AsymmetricKey *pKey, uint32_t *pLenMsg)
 Provides the maximum length in bytes of a message to be encrypted with a single asymmetric encryption operation.
 
SOPC_ReturnStatus SOPC_CryptoProvider_AsymmetricGetLength_MsgCipherText (const SOPC_CryptoProvider *pProvider, const SOPC_AsymmetricKey *pKey, uint32_t *pLenMsg)
 Provides the length in bytes of a ciphered message to be decrypted with a single asymmetric decryption operation.
 

Detailed Description

Defines the cryptographic abstraction interface for the SOPC_CryptoProvider. A cryptographic implementation must define all the functions declared in this file.

Function Documentation

◆ SOPC_CryptoProvider_Init()

SOPC_ReturnStatus SOPC_CryptoProvider_Init ( SOPC_CryptoProvider * pCryptoProvider)

Initializes a SOPC_CryptoProvider context. Called by SOPC_CryptoProvider_Create() upon context creation.

Parameters
pCryptoProviderA Cryptographic context to be initialized. It should uninitialized by SOPC_CryptoProvider_Deinit().
Note
The implementation is specific to the chosen cryptographic library.
Internal API.
Returns
SOPC_STATUS_OK when successful, SOPC_STATUS_INVALID_PARAMETERS when pCryptoProvider is NULL, SOPC_STATUS_NOK otherwise.

◆ SOPC_CryptoProvider_Deinit()

SOPC_ReturnStatus SOPC_CryptoProvider_Deinit ( SOPC_CryptoProvider * pCryptoProvider)

Deinitialize a SOPC_CryptoProvider context (this process is specific to the chosen cryptographic library). Called by SOPC_CryptoProvider_Free() upon context destruction.

Parameters
pCryptoProviderA Cryptographic context to be uninitialized.
Note
The implementation is specific to the chosen cryptographic library.
Internal API.
Returns
SOPC_STATUS_OK when successful, SOPC_STATUS_INVALID_PARAMETERS when pCryptoProvider is NULL.

◆ SOPC_CryptoProvider_AsymmetricGetLength_KeyBits()

SOPC_ReturnStatus SOPC_CryptoProvider_AsymmetricGetLength_KeyBits ( const SOPC_CryptoProvider * pProvider,
const SOPC_AsymmetricKey * pKey,
uint32_t * pLenKeyBits )

Writes the length in bits in pLenKeyBits of the asymmetric key pKey.

The main purpose of this function is to verify the length of the modulus of the asymmetric key pKey with respect to the security policy.

Parameters
pProviderAn initialized cryptographic context.
pKeyA valid pointer to an SOPC_AsymmetricKey.
pLenKeyBitsA valid pointer to the output length in bits. Its content is unspecified when return value is not SOPC_STATUS_OK.
Note
The implementation is specific to the chosen cryptographic library.
Specific to client-server security policies.
Returns
SOPC_STATUS_OK when successful, SOPC_STATUS_INVALID_PARAMETERS when parameters are NULL or pProvider not correctly initialized.

◆ SOPC_CryptoProvider_AsymmetricGetLength_MsgPlainText()

SOPC_ReturnStatus SOPC_CryptoProvider_AsymmetricGetLength_MsgPlainText ( const SOPC_CryptoProvider * pProvider,
const SOPC_AsymmetricKey * pKey,
uint32_t * pLenMsg )

Provides the maximum length in bytes of a message to be encrypted with a single asymmetric encryption operation.

Parameters
pProviderAn initialized cryptographic context.
pKeyA valid pointer to an SOPC_AsymmetricKey.
pLenMsgA valid pointer to the length in bytes of the maximum length in bytes of the plain text message used by the encryption process.
Note
The implementation is specific to the chosen cryptographic library.
Specific to client-server security policies.
Returns
SOPC_STATUS_OK when successful, SOPC_STATUS_INVALID_PARAMETERS when parameters are NULL or pProvider not correctly initialized.

◆ SOPC_CryptoProvider_AsymmetricGetLength_MsgCipherText()

SOPC_ReturnStatus SOPC_CryptoProvider_AsymmetricGetLength_MsgCipherText ( const SOPC_CryptoProvider * pProvider,
const SOPC_AsymmetricKey * pKey,
uint32_t * pLenMsg )

Provides the length in bytes of a ciphered message to be decrypted with a single asymmetric decryption operation.

Parameters
pProviderAn initialized cryptographic context.
pKeyA valid pointer to an SOPC_AsymmetricKey.
pLenMsgA valid pointer to the length in bytes of the ciphered message used by the decryption process.
Note
The implementation is specific to the chosen cryptographic library.
Specific to client-server security policies.
Returns
SOPC_STATUS_OK when successful, SOPC_STATUS_INVALID_PARAMETERS when parameters are NULL or pProvider not correctly initialized.