Go to the documentation of this file.
30 #ifndef SOPC_KEY_MANAGER_H_
31 #define SOPC_KEY_MANAGER_H_
107 uint32_t lenPassword);
173 uint32_t* pLenWritten);
193 const bool bIsPublic,
194 const char* filePath,
196 const uint32_t pwdLen);
241 uint32_t lenPassword);
354 uint32_t* pLenAllocated);
431 char** ppApplicationUri,
432 size_t* pStringLength);
460 char** ppSubjectName,
461 uint32_t* pSubjectNameLen);
478 char*** ppDnsNameArray,
479 uint32_t* pArrayLength);
543 const char* pThumbprint,
757 const bool bIsServer,
761 uint32_t arrayLength,
781 uint32_t* pLenAllocated);
SOPC_ReturnStatus SOPC_KeyManager_Certificate_IsSelfSigned(const SOPC_CertificateList *pCert, bool *pbIsSelfSigned)
Whether the first item of a certificate list is self signed.
bool SOPC_KeyManager_Certificate_CheckApplicationUri(const SOPC_CertificateList *pCert, const char *applicationUri)
Verify the application URI embedded in a certificate.
SOPC_ReturnStatus SOPC_KeyManager_SerializedAsymmetricKey_Deserialize(const SOPC_SerializedAsymmetricKey *key, bool is_public, SOPC_AsymmetricKey **res)
Deserializes a serialized key.
SOPC_ReturnStatus SOPC_KeyManager_Certificate_CreateOrAddFromFile(const char *szPath, SOPC_CertificateList **ppCert)
Creates a new Certificate (signed public key) from a file in the DER or PEM format,...
SOPC_ReturnStatus SOPC_KeyManager_SerializedCertificate_Deserialize(const SOPC_SerializedCertificate *cert, SOPC_CertificateList **res)
Deserializes a serialized certificate.
The signed public key representation, or a chained list of such keys.
Definition: key_manager_lib.h:67
SOPC_Buffer SOPC_SerializedCertificate
A serialized representation of a certificate.
Definition: sopc_key_manager.h:51
SOPC_SecretBuffer SOPC_SerializedAsymmetricKey
A serialized representation of an asymmetric key.
Definition: sopc_key_manager.h:44
SOPC_ReturnStatus SOPC_KeyManager_CertificateList_FindCertInList(const SOPC_CertificateList *pList, const SOPC_CertificateList *pCert, bool *pbMatch)
Finds whether a certificate is in the given certificate list or not.
SOPC_ReturnStatus SOPC_KeyManager_CertificateList_RemoveCAWithoutCRL(SOPC_CertificateList **ppCert, const SOPC_CRLList *pCRL, bool *pbMatch)
Removes (and frees) certificates from ppCert that do not have exactly one revocation list in pCRL.
SOPC_ReturnStatus SOPC_KeyManager_Certificate_GetSubjectName(const SOPC_CertificateList *pCert, char **ppSubjectName, uint32_t *pSubjectNameLen)
Returns the subject name of certificate pCert as a C String.
SOPC_ReturnStatus SOPC_KeyManager_Certificate_ToDER_Files(SOPC_CertificateList *pCerts, const char *directoryPath)
Write all the certificates of pCerts in DER files at destination directoryPath . File names are defin...
SOPC_ReturnStatus SOPC_KeyManager_Certificate_GetListLength(const SOPC_CertificateList *pCert, size_t *pLength)
Return the number of chained certificates in the certificate list pCert.
void SOPC_KeyManager_CRL_Free(SOPC_CRLList *pCRL)
Frees a Certificate created with SOPC_KeyManager_CRL_CreateOrAddFromFile or SOPC_KeyManager_CRL_Creat...
const SOPC_Buffer * SOPC_KeyManager_SerializedCertificate_Data(const SOPC_SerializedCertificate *cert)
Returns the data held in a serialized certificate.
SOPC_ReturnStatus SOPC_KeyManager_CSR_ToDER(SOPC_CSR *pCSR, SOPC_AsymmetricKey *pKey, uint8_t **ppDest, uint32_t *pLenAllocated)
Encodes CSR pCSR as a DER buffer and writes the result in ppDest.
SOPC_ReturnStatus SOPC_KeyManager_Certificate_CreateOrAddFromDER(const uint8_t *bufferDER, uint32_t lenDER, SOPC_CertificateList **ppCert)
Creates a new Certificate (signed public key) from a DER encoded buffer, or add it to an existing cer...
SOPC_ReturnStatus SOPC_KeyManager_CRL_ToDER_Files(SOPC_CRLList *pCrls, const char *directoryPath)
Write all the CRL ( pCrls ) in DER files. at destination directoryPath . File names are defined using...
SOPC_ReturnStatus SOPC_KeyManager_Certificate_Copy(const SOPC_CertificateList *pCert, SOPC_CertificateList **ppCertCopy)
Makes a copy of a given certificate list.
Defines the common declarations for the cryptographic objects.
SOPC_ReturnStatus SOPC_KeyManager_SerializedAsymmetricKey_CreateFromFile(const char *path, SOPC_SerializedAsymmetricKey **key)
Creates a serialized asymmetric key from a file in DER or PEM format.
SOPC_ReturnStatus SOPC_KeyManager_Certificate_GetMaybeApplicationUri(const SOPC_CertificateList *pCert, char **ppApplicationUri, size_t *pStringLength)
Copy the application URI embedded in a certificate.
SOPC_ReturnStatus SOPC_KeyManager_AsymmetricKey_ToPEMFile(SOPC_AsymmetricKey *pKey, const bool bIsPublic, const char *filePath, const char *pwd, const uint32_t pwdLen)
Write an asymmetric key to a PEM file.
SOPC_ReturnStatus SOPC_KeyManager_AsymmetricKey_CreateFromBuffer(const uint8_t *buffer, uint32_t lenBuf, bool is_public, SOPC_AsymmetricKey **ppKey)
Creates an asymmetric key (usually a private key) from in-memory buffer buffer.
SOPC_ReturnStatus SOPC_KeyManager_AsymmetricKey_ToDER(const SOPC_AsymmetricKey *pKey, bool is_public, uint8_t *pDest, uint32_t lenDest, uint32_t *pLenWritten)
Encodes the pKey as a DER buffer, and writes the result in pDest.
Bytes buffer structure.
Definition: sopc_buffer.h:38
char * SOPC_KeyManager_Certificate_GetCstring_SHA1(const SOPC_CertificateList *pCert)
Returns the SHA-1 thumbprint of a certificate.
The SOPC_CryptoProvider context.
Definition: sopc_crypto_provider.h:47
SOPC_ReturnStatus SOPC_KeyManager_SerializedAsymmetricKey_CreateFromKey(const SOPC_AsymmetricKey *pKey, bool is_public, SOPC_SerializedAsymmetricKey **out)
Creates a serialized asymmetric key from an SOPC_AsymmetricKey structure.
SOPC_ReturnStatus SOPC_KeyManager_Certificate_ToDER(const SOPC_CertificateList *pCert, uint8_t **ppDest, uint32_t *pLenAllocated)
Encodes a pCert as a DER buffer and writes the result in ppDest.
SOPC_ReturnStatus SOPC_KeyManager_SerializedAsymmetricKey_CreateFromFile_WithPwd(const char *keyPath, SOPC_SerializedAsymmetricKey **key, char *password, uint32_t lenPassword)
Creates a serialized asymmetric key from a file in DER or PEM format with an optional password for th...
SOPC_ReturnStatus SOPC_KeyManager_Certificate_GetSanDnsNames(const SOPC_CertificateList *pCert, char ***ppDnsNameArray, uint32_t *pArrayLength)
Returns all the DNS names of certificate pCert as an array of C String.
void SOPC_KeyManager_AsymmetricKey_Free(SOPC_AsymmetricKey *pKey)
Frees a previously created asymmetric key created with SOPC_KeyManager_AsymmetricKey_CreateFromBuffer...
void SOPC_KeyManager_CSR_Free(SOPC_CSR *pCSR)
Frees a CSR created with SOPC_KeyManager_CSR_Create.
SOPC_ReturnStatus SOPC_KeyManager_CSR_Create(const char *subjectName, const bool bIsServer, const char *mdType, const char *uri, char **pDnsArray, uint32_t arrayLength, SOPC_CSR **ppCSR)
Create a certificate signing request signed with pKey.
void SOPC_KeyManager_SerializedAsymmetricKey_Delete(SOPC_SerializedAsymmetricKey *key)
Releases all resources associated to a serialized asymmetric key.
SOPC_ReturnStatus SOPC_KeyManager_CRL_CreateOrAddFromDER(const uint8_t *bufferDER, uint32_t lenDER, SOPC_CRLList **ppCRL)
Creates a new Certificate Revocation List (CRL) from a DER encoded buffer, or add it to an existing C...
SOPC_ReturnStatus SOPC_KeyManager_CRL_Copy(const SOPC_CRLList *pCrl, SOPC_CRLList **ppCrlCopy)
Makes a copy of a given CRL list.
void SOPC_KeyManager_SerializedCertificate_Delete(SOPC_SerializedCertificate *cert)
Releases all resources associated to a serialized certificate.
SOPC_ReturnStatus SOPC_KeyManager_SerializedCertificate_CreateFromFile(const char *path, SOPC_SerializedCertificate **cert)
Creates a serialized certificate from a file in DER format.
The CSR representation.
Definition: key_manager_lib.h:94
SOPC_ReturnStatus SOPC_KeyManager_CRL_GetListLength(const SOPC_CRLList *pCrl, size_t *pLength)
Returns the number of chained CRL in pCrl list.
The asymmetric key representation.
Definition: key_manager_lib.h:47
SOPC_ReturnStatus SOPC_KeyManager_CertificateList_RemoveCertFromSHA1(SOPC_CertificateList **ppCertList, SOPC_CRLList **ppCRLList, const char *pThumbprint, bool *pbMatch, bool *pbIsIssuer)
Remove a single Certificate from its thumbprint. If the Certificate is a CA Certificate then all the ...
struct SOPC_SecretBuffer SOPC_SecretBuffer
Definition: sopc_secret_buffer.h:35
SOPC_ReturnStatus SOPC_KeyManager_SerializedAsymmetricKey_CreateFromData(const uint8_t *data, uint32_t len, SOPC_SerializedAsymmetricKey **key)
Creates a serialized asymmetric key from a DER or PEM payload.
SOPC_ReturnStatus SOPC_KeyManager_AsymmetricKey_CreateFromCertificate(const SOPC_CertificateList *pCert, SOPC_AsymmetricKey **pKey)
Returns the public key of the signed public key.
SOPC_ReturnStatus SOPC_KeyManager_Certificate_GetThumbprint(const SOPC_CryptoProvider *pProvider, const SOPC_CertificateList *pCert, uint8_t *pDest, uint32_t lenDest)
Computes and writes the thumbprint of pCert to pDest.
SOPC_ReturnStatus SOPC_KeyManager_AsymmetricKey_GenRSA(uint32_t RSAKeySize, SOPC_AsymmetricKey **ppKey)
Generate an RSA asymmetric key.
SOPC_ReturnStatus SOPC_KeyManager_SerializedCertificate_CreateFromDER(const uint8_t *der, uint32_t len, SOPC_SerializedCertificate **cert)
Creates a serialized certificate from a DER payload.
SecretBuffer (mangled key) and ExposedBuffer (contiguous deciphered buffered) APIs.
SOPC_ReturnStatus SOPC_KeyManager_AsymmetricKey_CreateFromFile(const char *szPath, SOPC_AsymmetricKey **ppKey, char *password, uint32_t lenPassword)
Creates an asymmetric key (usually a private key) from a file in the DER or PEM format.
A list of Certificate Revocation Lists.
Definition: key_manager_lib.h:83
A buffer of bytes with a maximum size, length and position.
void SOPC_KeyManager_Certificate_Free(SOPC_CertificateList *pCert)
Frees a Certificate created with SOPC_KeyManager_Certificate_CreateOrAddFromFile or SOPC_KeyManager_C...
SOPC_ReturnStatus SOPC_KeyManager_CRL_CreateOrAddFromFile(const char *szPath, SOPC_CRLList **ppCRL)
Creates a new Certificate Revocation List (CRL) from a file in the DER or PEM format,...
SOPC_ReturnStatus
Definition: libs2opc_client.h:64