Go to the documentation of this file.
26 #ifndef SOPC_CRYPTO_PROVIDER_H_
27 #define SOPC_CRYPTO_PROVIDER_H_
162 uint32_t* pLengthOut);
181 uint32_t* pLengthOut);
236 uint32_t* pCipherTextBlockSize,
237 uint32_t* pPlainTextBlockSize);
252 uint32_t* pLenNonce);
271 uint32_t* pSymmCryptoKeyLength,
272 uint32_t* pSymmSignKeyLength,
273 uint32_t* pSymmInitVectorLength);
293 uint32_t* pLenKeyBytes);
331 uint32_t* pCipherTextBlockSize,
332 uint32_t* pPlainTextBlockSize);
353 uint32_t* pLengthOut);
375 uint32_t* pLengthOut);
491 const uint8_t* pInput,
492 uint32_t lenPlainText,
528 const uint8_t* pInput,
529 uint32_t lenCipherText,
568 const uint8_t* pInput,
574 uint32_t uSequenceNumber,
605 const uint8_t* pInput,
639 const uint8_t* pInput,
642 const uint8_t* pSignature,
754 uint32_t lenClientNonce,
756 uint32_t lenServerNonce,
785 uint32_t lenServerNonce,
813 uint32_t lenClientNonce,
853 const uint8_t* pInput,
858 const char** errorReason);
893 const uint8_t* pInput,
898 uint32_t* pLenWritten,
899 const char** errorReason);
938 const uint8_t* pInput,
942 uint32_t lenSignature,
943 const char** errorReason);
977 const uint8_t* pInput,
980 const uint8_t* pSignature,
981 uint32_t lenSignature,
982 const char** errorReason);
Defines the common declarations for the PKI objects. The structures and macros defined in this file a...
SOPC_ReturnStatus SOPC_CryptoProvider_PubSubGetLength_MessageRandom(const SOPC_CryptoProvider *pProvider, uint32_t *pLength)
Writes the length in bytes in pLength of the random bytes used for PubSub encryption/decryption.
const SOPC_CryptoProfile * SOPC_CryptoProvider_GetProfileServices(const SOPC_CryptoProvider *pProvider)
Returns the non NULL client-server crypto profile but returns NULL if the PubSub profile is non NULL.
SOPC_ReturnStatus SOPC_CryptoProvider_DeriveGetLengths(const SOPC_CryptoProvider *pProvider, uint32_t *pSymmCryptoKeyLength, uint32_t *pSymmSignKeyLength, uint32_t *pSymmInitVectorLength)
Provides the lengths in bytes of the secrets derived from the nonce exchange.
SOPC_CryptolibContext * pCryptolibContext
Definition: sopc_crypto_provider.h:62
SOPC_ReturnStatus SOPC_CryptoProvider_DeriveKeySets(const SOPC_CryptoProvider *pProvider, const SOPC_ExposedBuffer *pClientNonce, uint32_t lenClientNonce, const SOPC_ExposedBuffer *pServerNonce, uint32_t lenServerNonce, SOPC_SC_SecurityKeySet *pClientKeySet, SOPC_SC_SecurityKeySet *pServerKeySet)
Derive pseudo-random key sets from the randomly generated and shared secrets.
const SOPC_CryptoProfile_PubSub * SOPC_CryptoProvider_GetProfilePubSub(const SOPC_CryptoProvider *pProvider)
Returns the non NULL PubSub crypto profile but returns NULL if the client-server profile is non NULL.
The signed public key representation.
Definition: key_manager_cyclone.h:60
SOPC_ReturnStatus SOPC_CryptoProvider_AsymmetricEncrypt(const SOPC_CryptoProvider *pProvider, const uint8_t *pInput, uint32_t lenInput, const SOPC_AsymmetricKey *pKey, uint8_t *pOutput, uint32_t lenOutput, const char **errorReason)
Encrypts a payload pInput of lenInput bytes.
The PKIProvider object for the Public Key Infrastructure.
Definition: sopc_pki_struct_lib_internal.h:129
const SOPC_CryptoProfile_PubSub *const pProfilePubSub
Definition: sopc_crypto_provider.h:57
SOPC_CryptoProvider * SOPC_CryptoProvider_Create(const char *uri)
Creates an initialized SOPC_CryptoProvider context for a client-server connection from a string conta...
SOPC_ReturnStatus SOPC_CryptoProvider_DerivePseudoRandomData(const SOPC_CryptoProvider *pProvider, const SOPC_ExposedBuffer *pSecret, uint32_t lenSecret, const SOPC_ExposedBuffer *pSeed, uint32_t lenSeed, SOPC_ExposedBuffer *pOutput, uint32_t lenOutput)
Derives pseudo-random data from the randomly generated and shared secrets.
SOPC_ReturnStatus SOPC_CryptoProvider_GenerateRandomID(const SOPC_CryptoProvider *pProvider, uint32_t *pID)
Generates 4 bytes of truly random data.
SOPC_ReturnStatus SOPC_CryptoProvider_SymmetricGetLength_Signature(const SOPC_CryptoProvider *pProvider, uint32_t *pLength)
Provides the length in bytes of the symmetric signature message.
SOPC_ReturnStatus SOPC_CryptoProvider_AsymmetricDecrypt(const SOPC_CryptoProvider *pProvider, const uint8_t *pInput, uint32_t lenInput, const SOPC_AsymmetricKey *pKey, uint8_t *pOutput, uint32_t lenOutput, uint32_t *pLenWritten, const char **errorReason)
Decrypts a payload pInput of lenInput bytes.
SOPC_ReturnStatus SOPC_CryptoProvider_Certificate_Validate(const SOPC_CryptoProvider *pProvider, SOPC_PKIProvider *pPKI, const SOPC_PKI_Type PKIType, const SOPC_CertificateList *pCert, uint32_t *error)
Validates the given Certificate pCert.
Defines the common declarations for the cryptographic objects. The structures and macros defined in t...
SOPC_ReturnStatus SOPC_CryptoProvider_GenerateRandomBytes(const SOPC_CryptoProvider *pProvider, uint32_t nBytes, SOPC_ExposedBuffer **ppBuffer)
Generates truly random data of arbitrary length.
Definition: crypto_provider_cyclone.h:29
The SOPC_CryptoProvider context.
Definition: sopc_crypto_provider.h:43
SOPC_ReturnStatus SOPC_CryptoProvider_AsymmetricGetLength_Encryption(const SOPC_CryptoProvider *pProvider, const SOPC_AsymmetricKey *pKey, uint32_t lengthIn, uint32_t *pLengthOut)
Calculates the size of the required output buffer to cipher lengthIn bytes through asymmetric encrypt...
SOPC_ReturnStatus SOPC_CryptoProvider_SymmetricVerify(const SOPC_CryptoProvider *pProvider, const uint8_t *pInput, uint32_t lenInput, SOPC_SecretBuffer *pKey, const uint8_t *pSignature, uint32_t lenOutput)
Verifies the signature pSignature of the payload pInput of lenInput bytes.
SOPC_ReturnStatus SOPC_CryptoProvider_SymmetricDecrypt(const SOPC_CryptoProvider *pProvider, const uint8_t *pInput, uint32_t lenCipherText, SOPC_SecretBuffer *pKey, SOPC_SecretBuffer *pIV, uint8_t *pOutput, uint32_t lenOutput)
Decrypts a payload pInput of lenPlainText bytes into a padded deciphered payload pOutput.
SOPC_ReturnStatus SOPC_CryptoProvider_AsymmetricGetLength_KeyBytes(const SOPC_CryptoProvider *pProvider, const SOPC_AsymmetricKey *pKey, uint32_t *pLenKeyBytes)
Writes the length in bytes in pLenKeyBytes of the asymmetric key pKey.
SOPC_ReturnStatus SOPC_CryptoProvider_GenerateSecureChannelNonce(const SOPC_CryptoProvider *pProvider, SOPC_SecretBuffer **ppNonce)
Generates a single truly random nonce for the SecureChannel creation.
SOPC_ReturnStatus SOPC_CryptoProvider_AsymmetricGetLength_OAEPHashLength(const SOPC_CryptoProvider *pProvider, uint32_t *length)
Provides the length of the hash used for OAEP encryption/decryption.
SOPC_ReturnStatus SOPC_CryptoProvider_DeriveKeySetsServer(const SOPC_CryptoProvider *pProvider, const SOPC_ExposedBuffer *pClientNonce, uint32_t lenClientNonce, SOPC_SecretBuffer *pServerNonce, SOPC_SC_SecurityKeySet *pClientKeySet, SOPC_SC_SecurityKeySet *pServerKeySet)
Derive pseudo-random key sets from the randomly generated and shared secrets.
SOPC_ReturnStatus SOPC_CryptoProvider_SymmetricSign(const SOPC_CryptoProvider *pProvider, const uint8_t *pInput, uint32_t lenInput, SOPC_SecretBuffer *pKey, uint8_t *pOutput, uint32_t lenOutput)
Signs a payload pInput of lenInput bytes, writes the signature in pOutput of lenOutput bytes.
SOPC_ReturnStatus SOPC_CryptoProvider_SymmetricEncrypt(const SOPC_CryptoProvider *pProvider, const uint8_t *pInput, uint32_t lenPlainText, SOPC_SecretBuffer *pKey, SOPC_SecretBuffer *pIV, uint8_t *pOutput, uint32_t lenOutput)
Encrypts a padded payload pInput of lenPlainText bytes.
SOPC_ReturnStatus SOPC_CryptoProvider_SymmetricGetLength_SecureChannelNonce(const SOPC_CryptoProvider *pProvider, uint32_t *pLenNonce)
Provides the length in bytes of the SecureChannel nonces used in the symmetric encryption process.
SOPC_ReturnStatus SOPC_CryptoProvider_PubSubCrypt(const SOPC_CryptoProvider *pProvider, const uint8_t *pInput, uint32_t lenInput, SOPC_SecretBuffer *pKey, SOPC_SecretBuffer *pKeyNonce, const SOPC_ExposedBuffer *pRandom, uint32_t lenRandom, uint32_t uSequenceNumber, uint8_t *pOutput, uint32_t lenOutput)
Encrypts or Decrypts a payload pInput of lenInput bytes.
SOPC_ReturnStatus SOPC_CryptoProvider_SymmetricGetLength_CryptoKey(const SOPC_CryptoProvider *pProvider, uint32_t *pLength)
Writes the length in bytes in pLength of the key used for symmetric encryption/decryption.
void SOPC_CryptoProvider_Free(SOPC_CryptoProvider *pCryptoProvider)
Frees a SOPC_CryptoProvider created with SOPC_CryptoProvider_Create().
SOPC_PKI_Type
Type of PKI.
Definition: sopc_pki_decl.h:129
SOPC_CryptoProvider * SOPC_CryptoProvider_CreatePubSub(const char *uri)
Creates an initialized SOPC_CryptoProvider context for PubSub exchanges from a string containing the ...
SOPC_ReturnStatus SOPC_CryptoProvider_SymmetricGetLength_Decryption(const SOPC_CryptoProvider *pProvider, uint32_t lengthIn, uint32_t *pLengthOut)
Writes the length in bytes in pLengthOut of a decrypted message of lengthIn bytes.
SOPC_ReturnStatus SOPC_CryptoProvider_AsymmetricVerify(const SOPC_CryptoProvider *pProvider, const uint8_t *pInput, uint32_t lenInput, const SOPC_AsymmetricKey *pKeyRemotePublic, const uint8_t *pSignature, uint32_t lenSignature, const char **errorReason)
Verifies the signature pSignature of a payload pInput of lenInput bytes.
SOPC_ReturnStatus SOPC_CryptoProvider_DeriveKeySetsClient(const SOPC_CryptoProvider *pProvider, SOPC_SecretBuffer *pClientNonce, const SOPC_ExposedBuffer *pServerNonce, uint32_t lenServerNonce, SOPC_SC_SecurityKeySet *pClientKeySet, SOPC_SC_SecurityKeySet *pServerKeySet)
Derive pseudo-random key sets from the randomly generated and shared secrets.
SOPC_ReturnStatus SOPC_CryptoProvider_PubSubGetLength_KeyNonce(const SOPC_CryptoProvider *pProvider, uint32_t *pLength)
Writes the length in bytes in pLength of the key nonce used for PubSub encryption/decryption.
SOPC_ReturnStatus SOPC_CryptoProvider_AsymmetricGetLength_Decryption(const SOPC_CryptoProvider *pProvider, const SOPC_AsymmetricKey *pKey, uint32_t lengthIn, uint32_t *pLengthOut)
Calculates the size of the required output buffer to decipher lengthIn bytes through asymmetric decry...
The asymmetric key representation.
Definition: key_manager_cyclone.h:42
const SOPC_CryptoProfile *const pProfile
Definition: sopc_crypto_provider.h:50
SOPC_CryptoProfiles gather pointers to cryptographic functions of the security policies of OPC UA Ser...
Definition: sopc_crypto_profiles.h:181
Definition: sopc_key_sets.h:26
SOPC_CryptoProfiles_PubSub gather pointers to cryptographic functions of the security policies of OPC...
Definition: sopc_crypto_profiles.h:205
struct SOPC_SecretBuffer SOPC_SecretBuffer
Definition: sopc_secret_buffer.h:35
SOPC_ReturnStatus SOPC_CryptoProvider_AsymmetricGetLength_Signature(const SOPC_CryptoProvider *pProvider, const SOPC_AsymmetricKey *pKey, uint32_t *pLength)
Calculates the size of the required output buffer to contain the asymmetric signature.
uint8_t SOPC_ExposedBuffer
Definition: sopc_secret_buffer.h:36
SOPC_ReturnStatus SOPC_CryptoProvider_AsymmetricGetLength_Msgs(const SOPC_CryptoProvider *pProvider, const SOPC_AsymmetricKey *pKey, uint32_t *pCipherTextBlockSize, uint32_t *pPlainTextBlockSize)
Provides the lengths in bytes of the messages used in asymmetric encryption process.
SOPC_ReturnStatus SOPC_CryptoProvider_SymmetricGetLength_Blocks(const SOPC_CryptoProvider *pProvider, uint32_t *pCipherTextBlockSize, uint32_t *pPlainTextBlockSize)
Provides the lengths in bytes of the blocks used in the symmetric encryption process.
SOPC_ReturnStatus SOPC_CryptoProvider_AsymmetricSign(const SOPC_CryptoProvider *pProvider, const uint8_t *pInput, uint32_t lenInput, const SOPC_AsymmetricKey *pKeyPrivateLocal, uint8_t *pSignature, uint32_t lenSignature, const char **errorReason)
Signs a payload pInput of lenInput bytes.
const char * SOPC_CryptoProvider_AsymmetricGetUri_SignAlgorithm(const SOPC_CryptoProvider *pProvider)
Returns the URI of the AsymetricSignatureAlgorithm.
SOPC_ReturnStatus SOPC_CryptoProvider_SymmetricGetLength_SignKey(const SOPC_CryptoProvider *pProvider, uint32_t *pLength)
Writes the length in bytes in pLength of the key used for symmetric signature.
SOPC_ReturnStatus SOPC_CryptoProvider_SymmetricGetLength_Encryption(const SOPC_CryptoProvider *pProvider, uint32_t lengthIn, uint32_t *pLengthOut)
Writes the length in bytes in pLengthOut of an encrypted message of lengthIn bytes.
SOPC_ReturnStatus SOPC_CryptoProvider_CertificateGetLength_Thumbprint(const SOPC_CryptoProvider *pProvider, uint32_t *pLength)
Calculates the size of the signature of the certificates.
SOPC_ReturnStatus
Definition: libs2opc_client.h:64