open62541pp
0.17.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
{
10
11
enum class
CertificateFormat
{
12
DER
,
13
PEM
,
14
};
15
16
struct
CreateCertificateResult
{
17
ByteString
privateKey
;
18
ByteString
certificate
;
19
};
20
21
class
CreateCertificateError
:
public
std::runtime_error {
22
public
:
23
using
runtime_error::runtime_error;
// inherit constructors
24
};
25
26
/**
27
* Create a self-signed X.509 v3 certificate.
28
*
29
* It is recommended to store the generated certificate on disk for reuse, so the application can be
30
* recognized across several executions.
31
*
32
* @note Only available with open62541 >= v1.3 and OpenSSL/LibreSSL
33
*
34
* @param subject Elements for the subject,
35
* e.g. {"C=DE", "O=SampleOrganization", "CN=Open62541Server@localhost"}
36
* @param subjectAltName Elements for SubjectAltName,
37
* e.g. {"DNS:localhost", "URI:urn:open62541.server.application"}
38
* @param certificateFormat Certificate format, either DER or PEM
39
*
40
* @exception BadStatus (BadOutOfMemory)
41
* @exception CreateCertificateError
42
*
43
* @see UA_CreateCertificate
44
*/
45
CreateCertificateResult
createCertificate
(
46
Span<const String>
subject,
47
Span<const String>
subjectAltName,
48
CertificateFormat
certificateFormat =
CertificateFormat::DER
49
);
50
51
}
// namespace opcua
52
53
#endif
// if UAPP_HAS_CREATE_CERTIFICATE
opcua::ByteString
UA_ByteString wrapper class.
Definition
types.hpp:531
opcua::CreateCertificateError
Definition
create_certificate.hpp:21
opcua::Span
View to a contiguous sequence of objects, similar to std::span in C++20.
Definition
span.hpp:28
opcua
Definition
async.hpp:11
opcua::createCertificate
CreateCertificateResult createCertificate(Span< const String > subject, Span< const String > subjectAltName, CertificateFormat certificateFormat=CertificateFormat::DER)
Create a self-signed X.509 v3 certificate.
opcua::CertificateFormat
CertificateFormat
Definition
create_certificate.hpp:11
opcua::CertificateFormat::PEM
@ PEM
opcua::CertificateFormat::DER
@ DER
span.hpp
opcua::CreateCertificateResult
Definition
create_certificate.hpp:16
opcua::CreateCertificateResult::certificate
ByteString certificate
Definition
create_certificate.hpp:18
opcua::CreateCertificateResult::privateKey
ByteString privateKey
Definition
create_certificate.hpp:17
types.hpp
Generated by
1.12.0