S2OPC OPCUA Toolkit
sopc_key_cert_pair.h
Go to the documentation of this file.
1 /*
2  * Licensed to Systerel under one or more contributor license
3  * agreements. See the NOTICE file distributed with this work
4  * for additional information regarding copyright ownership.
5  * Systerel licenses this file to you under the Apache
6  * License, Version 2.0 (the "License"); you may not use this
7  * file except in compliance with the License. You may obtain
8  * a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
27 #ifndef SOPC_KEY_CERT_PAIR_H
28 #define SOPC_KEY_CERT_PAIR_H
29 
30 #include <stddef.h>
31 #include <stdint.h>
32 
33 #include "sopc_enums.h"
34 #include "sopc_key_manager.h"
35 
39 typedef struct SOPC_KeyCertPair SOPC_KeyCertPair;
40 
46 typedef void SOPC_KeyCertPairUpdateCb(uintptr_t updateParam);
47 
63  const char* privateKeyPath,
64  char* keyPassword,
65  SOPC_KeyCertPair** ppKeyCertPair);
66 
80  const unsigned char* certificate,
81  size_t keyNbBytes,
82  const unsigned char* privateKey,
83  SOPC_KeyCertPair** ppKeyCertPair);
84 
98  SOPC_KeyCertPairUpdateCb* updateCb,
99  uintptr_t updateParam);
100 
119  size_t certificateNbBytes,
120  const unsigned char* certificate,
121  size_t keyNbBytes,
122  const unsigned char* privateKey);
123 
134  SOPC_SerializedCertificate** ppCertCopy);
135 
146 
157 
164 
169 
183 
197  const unsigned char* certificate,
198  SOPC_CertHolder** ppCertHolder);
199 
200 #endif /* SOPC_KEY_CERT_PAIR_H */
SOPC_KeyCertPair_CreateFromBytes
SOPC_ReturnStatus SOPC_KeyCertPair_CreateFromBytes(size_t certificateNbBytes, const unsigned char *certificate, size_t keyNbBytes, const unsigned char *privateKey, SOPC_KeyCertPair **ppKeyCertPair)
Creates a private key / certificate pair from bytes arrays.
SOPC_CertificateList
The signed public key representation.
Definition: key_manager_cyclone.h:60
sopc_key_manager.h
The SOPC_KeyManager provides an API for Asymmetric Key Management such as loading signed public keys ...
SOPC_KeyCertPair_CreateCertHolderFromPath
SOPC_ReturnStatus SOPC_KeyCertPair_CreateCertHolderFromPath(const char *certPath, SOPC_CertHolder **ppCertHolder)
Creates a certificate holder from file path.
SOPC_KeyCertPair_CreateFromPaths
SOPC_ReturnStatus SOPC_KeyCertPair_CreateFromPaths(const char *certPath, const char *privateKeyPath, char *keyPassword, SOPC_KeyCertPair **ppKeyCertPair)
Creates a private key / certificate pair from file paths. The private key decryption password shall b...
SOPC_KeyCertPairUpdateCb
void SOPC_KeyCertPairUpdateCb(uintptr_t updateParam)
Type of the callback triggered on key / certificate update.
Definition: sopc_key_cert_pair.h:46
SOPC_KeyCertPair_Delete
void SOPC_KeyCertPair_Delete(SOPC_KeyCertPair **ppKeyCertPair)
Clears and frees the key / certificate pair and set pointer to NULL.
SOPC_KeyCertPair_GetSerializedCertCopy
SOPC_ReturnStatus SOPC_KeyCertPair_GetSerializedCertCopy(SOPC_KeyCertPair *keyCertPair, SOPC_SerializedCertificate **ppCertCopy)
Gets a copy of the serialized certificate contained in the key /certificate pair.
SOPC_Buffer
Bytes buffer structure.
Definition: sopc_buffer.h:38
sopc_enums.h
SOPC_KeyCertPair
struct SOPC_KeyCertPair SOPC_KeyCertPair
An abstract structure used to store a pair of private key and certificate.
Definition: sopc_key_cert_pair.h:39
SOPC_AsymmetricKey
The asymmetric key representation.
Definition: key_manager_cyclone.h:42
SOPC_KeyCertPair_UpdateFromBytes
SOPC_ReturnStatus SOPC_KeyCertPair_UpdateFromBytes(SOPC_KeyCertPair *keyCertPair, size_t certificateNbBytes, const unsigned char *certificate, size_t keyNbBytes, const unsigned char *privateKey)
Updates the private key and/or certificate of the pair from bytes arrays. If the certificate uses the...
SOPC_KeyCertPair_GetKeyCopy
SOPC_ReturnStatus SOPC_KeyCertPair_GetKeyCopy(SOPC_KeyCertPair *keyCertPair, SOPC_AsymmetricKey **ppKeyCopy)
Gets a copy of the private key contained in the key /certificate pair.
SOPC_KeyCertPair_GetCertCopy
SOPC_ReturnStatus SOPC_KeyCertPair_GetCertCopy(SOPC_KeyCertPair *keyCertPair, SOPC_CertificateList **ppCertCopy)
Gets a copy of the certificate contained in the key /certificate pair.
SOPC_KeyCertPair_CreateCertHolderFromBytes
SOPC_ReturnStatus SOPC_KeyCertPair_CreateCertHolderFromBytes(size_t certificateNbBytes, const unsigned char *certificate, SOPC_CertHolder **ppCertHolder)
Creates a certificate holder from bytes arrays.
SOPC_KeyCertPair_SetUpdateCb
SOPC_ReturnStatus SOPC_KeyCertPair_SetUpdateCb(SOPC_KeyCertPair *keyCertPair, SOPC_KeyCertPairUpdateCb *updateCb, uintptr_t updateParam)
Defines the callback to be called when a key/certificate update is done with SOPC_KeyCertPair_UpdateF...
SOPC_CertHolder
SOPC_KeyCertPair SOPC_CertHolder
An abstract structure used to store a certificate in a thread-safe context.
Definition: sopc_key_cert_pair.h:168
SOPC_ReturnStatus
SOPC_ReturnStatus
Definition: libs2opc_client.h:64