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 QOPCUAX509EXTENSIONKEYUSAGE_H |
5 | #define QOPCUAX509EXTENSIONKEYUSAGE_H |
6 | |
7 | #include "QtOpcUa/qopcuax509extension.h" |
8 | #include <QtOpcUa/qopcuaglobal.h> |
9 | |
10 | QT_BEGIN_NAMESPACE |
11 | |
12 | class Q_OPCUA_EXPORT QOpcUaX509ExtensionKeyUsage : public QOpcUaX509Extension |
13 | { |
14 | public: |
15 | enum class KeyUsage : uint { |
16 | DigitalSignature, |
17 | NonRepudiation, |
18 | KeyEncipherment, |
19 | DataEncipherment, |
20 | KeyAgreement, |
21 | CertificateSigning, |
22 | CrlSigning, |
23 | EnciptherOnly, |
24 | DecipherOnly |
25 | }; |
26 | |
27 | QOpcUaX509ExtensionKeyUsage(); |
28 | QOpcUaX509ExtensionKeyUsage(const QOpcUaX509ExtensionKeyUsage &); |
29 | QOpcUaX509ExtensionKeyUsage &operator=(const QOpcUaX509ExtensionKeyUsage &); |
30 | bool operator==(const QOpcUaX509ExtensionKeyUsage &rhs) const; |
31 | ~QOpcUaX509ExtensionKeyUsage(); |
32 | |
33 | void setKeyUsage(KeyUsage keyUsage, bool enable = true); |
34 | bool keyUsage(KeyUsage) const; |
35 | }; |
36 | |
37 | #if QT_VERSION >= 0x060000 |
38 | inline size_t qHash(const QOpcUaX509ExtensionKeyUsage::KeyUsage &key) |
39 | #else |
40 | inline uint qHash(const QOpcUaX509ExtensionKeyUsage::KeyUsage &key) |
41 | #endif |
42 | { |
43 | return ::qHash(key: static_cast<uint>(key)); |
44 | } |
45 | |
46 | QT_END_NAMESPACE |
47 | |
48 | #endif // QOPCUAX509EXTENSIONKEYUSAGE_H |
49 | |