open62541pp 0.17.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
create_certificate.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "open62541pp/config.hpp"
6
7#if UAPP_HAS_CREATE_CERTIFICATE
8
9namespace opcua {
10
12 DER,
13 PEM,
14};
15
20
21class CreateCertificateError : public std::runtime_error {
22public:
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 */
46 Span<const String> subject,
47 Span<const String> subjectAltName,
49);
50
51} // namespace opcua
52
53#endif // if UAPP_HAS_CREATE_CERTIFICATE
UA_ByteString wrapper class.
Definition types.hpp:531
View to a contiguous sequence of objects, similar to std::span in C++20.
Definition span.hpp:28
CreateCertificateResult createCertificate(Span< const String > subject, Span< const String > subjectAltName, CertificateFormat certificateFormat=CertificateFormat::DER)
Create a self-signed X.509 v3 certificate.