1// Copyright (C) 2021 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
5#ifndef QSSL_H
6#define QSSL_H
7
8#if 0
9#pragma qt_class(QSsl)
10#endif
11
12#include <QtNetwork/qtnetworkglobal.h>
13#include <QtCore/qobjectdefs.h>
14#include <QtCore/QFlags>
15
16QT_BEGIN_NAMESPACE
17
18
19namespace QSsl {
20 Q_NAMESPACE_EXPORT(Q_NETWORK_EXPORT)
21
22 enum KeyType {
23 PrivateKey,
24 PublicKey
25 };
26 Q_ENUM_NS(KeyType)
27
28 enum EncodingFormat {
29 Pem,
30 Der
31 };
32 Q_ENUM_NS(EncodingFormat)
33
34 enum KeyAlgorithm {
35 Opaque,
36 Rsa,
37 Dsa,
38 Ec,
39 Dh,
40 };
41 Q_ENUM_NS(KeyAlgorithm)
42
43 enum AlternativeNameEntryType {
44 EmailEntry,
45 DnsEntry,
46 IpAddressEntry
47 };
48 Q_ENUM_NS(AlternativeNameEntryType)
49
50 enum SslProtocol {
51 TlsV1_0 QT_DEPRECATED_VERSION_X_6_3("Use TlsV1_2OrLater instead."),
52 TlsV1_1 QT_DEPRECATED_VERSION_X_6_3("Use TlsV1_2OrLater instead."),
53 TlsV1_2,
54 AnyProtocol,
55 SecureProtocols,
56
57 TlsV1_0OrLater QT_DEPRECATED_VERSION_X_6_3("Use TlsV1_2OrLater instead."),
58 TlsV1_1OrLater QT_DEPRECATED_VERSION_X_6_3("Use TlsV1_2OrLater instead."),
59 TlsV1_2OrLater,
60
61 DtlsV1_0 QT_DEPRECATED_VERSION_X_6_3("Use DtlsV1_2OrLater instead."),
62 DtlsV1_0OrLater QT_DEPRECATED_VERSION_X_6_3("Use DtlsV1_2OrLater instead."),
63 DtlsV1_2,
64 DtlsV1_2OrLater,
65
66 TlsV1_3,
67 TlsV1_3OrLater,
68
69 UnknownProtocol = -1
70 };
71 Q_ENUM_NS(SslProtocol)
72
73 enum SslOption {
74 SslOptionDisableEmptyFragments = 0x01,
75 SslOptionDisableSessionTickets = 0x02,
76 SslOptionDisableCompression = 0x04,
77 SslOptionDisableServerNameIndication = 0x08,
78 SslOptionDisableLegacyRenegotiation = 0x10,
79 SslOptionDisableSessionSharing = 0x20,
80 SslOptionDisableSessionPersistence = 0x40,
81 SslOptionDisableServerCipherPreference = 0x80
82 };
83 Q_ENUM_NS(SslOption)
84 Q_DECLARE_FLAGS(SslOptions, SslOption)
85
86 enum class AlertLevel {
87 Warning,
88 Fatal,
89 Unknown
90 };
91 Q_ENUM_NS(AlertLevel)
92
93 enum class AlertType {
94 CloseNotify,
95 UnexpectedMessage = 10,
96 BadRecordMac = 20,
97 RecordOverflow = 22,
98 DecompressionFailure = 30, // reserved
99 HandshakeFailure = 40,
100 NoCertificate = 41, // reserved
101 BadCertificate = 42,
102 UnsupportedCertificate = 43,
103 CertificateRevoked = 44,
104 CertificateExpired = 45,
105 CertificateUnknown = 46,
106 IllegalParameter = 47,
107 UnknownCa = 48,
108 AccessDenied = 49,
109 DecodeError = 50,
110 DecryptError = 51,
111 ExportRestriction = 60, // reserved
112 ProtocolVersion = 70,
113 InsufficientSecurity = 71,
114 InternalError = 80,
115 InappropriateFallback = 86,
116 UserCancelled = 90,
117 NoRenegotiation = 100,
118 MissingExtension = 109,
119 UnsupportedExtension = 110,
120 CertificateUnobtainable = 111, // reserved
121 UnrecognizedName = 112,
122 BadCertificateStatusResponse = 113,
123 BadCertificateHashValue = 114, // reserved
124 UnknownPskIdentity = 115,
125 CertificateRequired = 116,
126 NoApplicationProtocol = 120,
127 UnknownAlertMessage = 255
128 };
129 Q_ENUM_NS(AlertType)
130
131 enum class ImplementedClass
132 {
133 Key,
134 Certificate,
135 Socket,
136 DiffieHellman,
137 EllipticCurve,
138 Dtls,
139 DtlsCookie
140 };
141 Q_ENUM_NS(ImplementedClass)
142
143 enum class SupportedFeature
144 {
145 CertificateVerification,
146 ClientSideAlpn,
147 ServerSideAlpn,
148 Ocsp,
149 Psk,
150 SessionTicket,
151 Alerts
152 };
153 Q_ENUM_NS(SupportedFeature)
154}
155
156Q_DECLARE_OPERATORS_FOR_FLAGS(QSsl::SslOptions)
157
158QT_END_NAMESPACE
159
160#endif // QSSL_H
161