| 1 | // Copyright (C) 2019 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QOPCUAX509CERTIFICATESIGNINGREQUEST_H |
| 5 | #define QOPCUAX509CERTIFICATESIGNINGREQUEST_H |
| 6 | |
| 7 | #include "QtOpcUa/qopcuakeypair.h" |
| 8 | #include "QtOpcUa/qopcuax509extension.h" |
| 9 | #include "QtOpcUa/qopcuax509distinguishedname.h" |
| 10 | #include <QtOpcUa/qopcuaglobal.h> |
| 11 | #include <QtOpcUa/qopcuax509certificatesigningrequest.h> |
| 12 | |
| 13 | QT_BEGIN_NAMESPACE |
| 14 | |
| 15 | class QOpcUaX509CertificateSigningRequestPrivate; |
| 16 | |
| 17 | class Q_OPCUA_EXPORT QOpcUaX509CertificateSigningRequest |
| 18 | { |
| 19 | Q_DECLARE_PRIVATE(QOpcUaX509CertificateSigningRequest) |
| 20 | |
| 21 | public: |
| 22 | enum class MessageDigest { |
| 23 | SHA256, |
| 24 | }; |
| 25 | enum class Encoding { |
| 26 | PEM, |
| 27 | DER, |
| 28 | }; |
| 29 | |
| 30 | QOpcUaX509CertificateSigningRequest(); |
| 31 | ~QOpcUaX509CertificateSigningRequest(); |
| 32 | |
| 33 | void setMessageDigest(MessageDigest digest); |
| 34 | MessageDigest messageDigest() const; |
| 35 | |
| 36 | void setEncoding(Encoding encoding); |
| 37 | Encoding encoding() const; |
| 38 | |
| 39 | void setSubject(const QOpcUaX509DistinguishedName &subject); |
| 40 | const QOpcUaX509DistinguishedName &subject() const; |
| 41 | |
| 42 | void addExtension(QOpcUaX509Extension *extension); |
| 43 | QByteArray createRequest(const QOpcUaKeyPair &privateKey); |
| 44 | QByteArray createSelfSignedCertificate(const QOpcUaKeyPair &privateKey, int validityInDays = 365); |
| 45 | |
| 46 | private: |
| 47 | QOpcUaX509CertificateSigningRequestPrivate *d_ptr = nullptr; |
| 48 | }; |
| 49 | |
| 50 | QT_END_NAMESPACE |
| 51 | |
| 52 | #endif // QOPCUAX509CERTIFICATESIGNINGREQUEST_H |
| 53 | |