S2OPC OPCUA Toolkit
Data Structures | Functions
key_manager_lib.h File Reference
#include <stdbool.h>
#include "sopc_crypto_decl.h"
#include "sopc_enums.h"
#include "mbedtls_common.h"
#include "mbedtls/pk.h"
#include "mbedtls/x509_crt.h"

Go to the source code of this file.

Data Structures

struct  SOPC_AsymmetricKey
 The asymmetric key representation. More...
 
struct  SOPC_CertificateList
 The signed public key representation, or a chained list of such keys. More...
 
struct  SOPC_CRLList
 A list of Certificate Revocation Lists. More...
 

Functions

SOPC_ReturnStatus KeyManager_Certificate_GetPublicKey (const SOPC_CertificateList *pCert, SOPC_AsymmetricKey *pKey)
 Returns the internal public key of the given signed public key. More...
 

Detailed Description

Implementations for SOPC_AsymmetricKey and SOPC_CertificateList are mainly lib-specific.

Function Documentation

◆ KeyManager_Certificate_GetPublicKey()

SOPC_ReturnStatus KeyManager_Certificate_GetPublicKey ( const SOPC_CertificateList pCert,
SOPC_AsymmetricKey pKey 
)

Returns the internal public key of the given signed public key.

Warning
The returned SOPC_AsymmetricKey must not be freed with SOPC_KeyManager_AsymmetricKey_Free() and the key must not be used after the SOPC_CertificateList is freed by SOPC_KeyManager_Certificate_Free().
A special flag isBorrowedFromCert is set to !FALSE in this case in the SOPC_AsymmetricKey.
Parameters
pCertA valid pointer to the signed public key.
pKeyA valid pointer to the SOPC_AsymmetricKey which will be rewritten to contain the public key. This is not a deep copy, and the key is not valid anymore when the certificate is not valid.
Note
Content of the certificate is unspecified when return value is not SOPC_STATUS_OK.
Returns
SOPC_STATUS_OK when successful, SOPC_STATUS_INVALID_PARAMETERS when parameters are NULL, and SOPC_STATUS_NOK when there was an error.