open62541pp
0.16.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
include
open62541pp
plugin
create_certificate.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "open62541pp/config.hpp"
4
#include "
open62541pp/span.hpp
"
5
#include "
open62541pp/types.hpp
"
6
7
#if UAPP_HAS_CREATE_CERTIFICATE
8
9
namespace
opcua::crypto
{
10
11
enum class
CertificateFormat
{
12
DER
,
13
PEM
,
14
};
15
16
struct
CreateCertificateResult
{
17
ByteString
privateKey
;
18
ByteString
certificate
;
19
};
20
21
/**
22
* Create a self-signed X.509 v3 certificate.
23
*
24
* It is recommended to store the generated certificate on disk for reuse, so the application can be
25
* recognized across several executions.
26
*
27
* @note Only available with open62541 >= v1.3 and OpenSSL/LibreSSL
28
*
29
* @param subject Elements for the subject,
30
* e.g. {"C=DE", "O=SampleOrganization", "CN=Open62541Server@localhost"}
31
* @param subjectAltName Elements for SubjectAltName,
32
* e.g. {"DNS:localhost", "URI:urn:open62541.server.application"}
33
* @param certificateFormat Certificate format, either DER or PEM
34
*
35
* @exception BadStatus (BadOutOfMemory)
36
* @exception CreateCertificateError
37
*
38
* @see UA_CreateCertificate
39
*/
40
CreateCertificateResult
createCertificate
(
41
Span<const String>
subject,
42
Span<const String>
subjectAltName,
43
CertificateFormat
certificateFormat =
CertificateFormat::DER
44
);
45
46
}
// namespace opcua::crypto
47
48
#endif
// if UAPP_HAS_CREATE_CERTIFICATE
opcua::ByteString
UA_ByteString wrapper class.
Definition
types.hpp:490
opcua::Span
View to a contiguous sequence of objects, similar to std::span in C++20.
Definition
span.hpp:26
opcua::crypto
Definition
create_certificate.hpp:9
opcua::crypto::CertificateFormat
CertificateFormat
Definition
create_certificate.hpp:11
opcua::crypto::CertificateFormat::PEM
@ PEM
opcua::crypto::CertificateFormat::DER
@ DER
opcua::crypto::createCertificate
CreateCertificateResult createCertificate(Span< const String > subject, Span< const String > subjectAltName, CertificateFormat certificateFormat=CertificateFormat::DER)
Create a self-signed X.509 v3 certificate.
span.hpp
opcua::crypto::CreateCertificateResult
Definition
create_certificate.hpp:16
opcua::crypto::CreateCertificateResult::privateKey
ByteString privateKey
Definition
create_certificate.hpp:17
opcua::crypto::CreateCertificateResult::certificate
ByteString certificate
Definition
create_certificate.hpp:18
types.hpp
Generated by
1.11.0