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// Qt-Security score:significant reason:default
4
5
6#include "qsslkey.h"
7#include "qssl_p.h"
8
9QT_BEGIN_NAMESPACE
10
11Q_LOGGING_CATEGORY(lcSsl, "qt.network.ssl");
12
13/*! \namespace QSsl
14
15 \brief The QSsl namespace declares enums common to all SSL classes in Qt Network.
16 \since 4.3
17
18 \ingroup network
19 \ingroup ssl
20 \inmodule QtNetwork
21*/
22
23/*!
24 \enum QSsl::KeyType
25
26 Describes the two types of keys QSslKey supports.
27
28 \value PrivateKey A private key.
29 \value PublicKey A public key.
30*/
31
32/*!
33 \enum QSsl::KeyAlgorithm
34
35 Describes the different key algorithms supported by QSslKey.
36
37 \value Rsa The RSA algorithm.
38 \value Dsa The DSA algorithm.
39 \value Ec The Elliptic Curve algorithm.
40 \value Dh The Diffie-Hellman algorithm.
41 \value Opaque A key that should be treated as a 'black box' by QSslKey.
42
43 The opaque key facility allows applications to add support for facilities
44 such as PKCS#11 that Qt does not currently offer natively.
45*/
46
47/*!
48 \enum QSsl::EncodingFormat
49
50 Describes supported encoding formats for certificates and keys.
51
52 \value Pem The PEM format.
53 \value Der The DER format.
54*/
55
56/*!
57 \enum QSsl::AlternativeNameEntryType
58
59 Describes the key types for alternative name entries in QSslCertificate.
60
61 \value EmailEntry An email entry; the entry contains an email address that
62 the certificate is valid for.
63
64 \value DnsEntry A DNS host name entry; the entry contains a host name
65 entry that the certificate is valid for. The entry may contain wildcards.
66
67 \value IpAddressEntry An IP address entry; the entry contains an IP address
68 entry that the certificate is valid for, introduced in Qt 5.13.
69
70 \sa QSslCertificate::subjectAlternativeNames()
71*/
72
73/*!
74 \enum QSsl::SslProtocol
75
76 Describes the protocol of the cipher.
77
78 \value TlsV1_0 TLSv1.0
79 \value TlsV1_0OrLater TLSv1.0 and later versions.
80 \value TlsV1_1 TLSv1.1.
81 \value TlsV1_1OrLater TLSv1.1 and later versions.
82 \value TlsV1_2 TLSv1.2.
83 \value TlsV1_2OrLater TLSv1.2 and later versions.
84 \value DtlsV1_0 DTLSv1.0
85 \value DtlsV1_0OrLater DTLSv1.0 and later versions.
86 \value DtlsV1_2 DTLSv1.2
87 \value DtlsV1_2OrLater DTLSv1.2 and later versions.
88 \value [since 5.12] TlsV1_3 TLSv1.3.
89 \value [since 5.12] TlsV1_3OrLater TLSv1.3 and later versions.
90 \value UnknownProtocol The cipher's protocol cannot be determined.
91 \value AnyProtocol Any supported protocol. This value is used by QSslSocket only.
92 \value SecureProtocols The default option, using protocols known to be secure.
93*/
94
95/*!
96 \enum QSsl::SslOption
97
98 Describes the options that can be used to control the details of
99 SSL behaviour. These options are generally used to turn features off
100 to work around buggy servers.
101
102 \value SslOptionDisableEmptyFragments Disables the insertion of empty
103 fragments into the data when using block ciphers. When enabled, this
104 prevents some attacks (such as the BEAST attack), however it is
105 incompatible with some servers.
106 \value SslOptionDisableSessionTickets Disables the SSL session ticket
107 extension. This can cause slower connection setup, however some servers
108 are not compatible with the extension.
109 \value SslOptionDisableCompression Disables the SSL compression
110 extension. When enabled, this allows the data being passed over SSL to
111 be compressed, however some servers are not compatible with this
112 extension.
113 \value SslOptionDisableServerNameIndication Disables the SSL server
114 name indication extension. When enabled, this tells the server the virtual
115 host being accessed allowing it to respond with the correct certificate.
116 \value SslOptionDisableLegacyRenegotiation Disables the older insecure
117 mechanism for renegotiating the connection parameters. When enabled, this
118 option can allow connections for legacy servers, but it introduces the
119 possibility that an attacker could inject plaintext into the SSL session.
120 \value SslOptionDisableSessionSharing Disables SSL session sharing via
121 the session ID handshake attribute.
122 \value SslOptionDisableSessionPersistence Disables storing the SSL session
123 in ASN.1 format as returned by QSslConfiguration::sessionTicket(). Enabling
124 this feature adds memory overhead of approximately 1K per used session
125 ticket.
126 \value SslOptionDisableServerCipherPreference Disables selecting the cipher
127 chosen based on the servers preferences rather than the order ciphers were
128 sent by the client. This option is only relevant to server sockets, and is
129 only honored by the OpenSSL backend.
130
131 By default, SslOptionDisableEmptyFragments is turned on since this causes
132 problems with a large number of servers. SslOptionDisableLegacyRenegotiation
133 is also turned on, since it introduces a security risk.
134 SslOptionDisableCompression is turned on to prevent the attack publicised by
135 CRIME.
136 SslOptionDisableSessionPersistence is turned on to optimize memory usage.
137 The other options are turned off.
138
139 \note Availability of above options depends on the version of the SSL
140 backend in use.
141*/
142
143/*!
144 \enum QSsl::AlertLevel
145 \brief Describes the level of an alert message
146 \relates QSslSocket
147 \since 6.0
148
149 \ingroup network
150 \ingroup ssl
151 \inmodule QtNetwork
152
153 This enum describes the level of an alert message that was sent
154 or received.
155
156 \value Warning Non-fatal alert message
157 \value Fatal Fatal alert message, the underlying backend will
158 handle such an alert properly and close the connection.
159 \value Unknown An alert of unknown level of severity.
160*/
161
162/*!
163 \enum QSsl::AlertType
164 \brief Enumerates possible codes that an alert message can have
165 \relates QSslSocket
166 \since 6.0
167
168 \ingroup network
169 \ingroup ssl
170 \inmodule QtNetwork
171
172 See \l{RFC 8446, section 6}
173 for the possible values and their meaning.
174
175 \value CloseNotify,
176 \value UnexpectedMessage
177 \value BadRecordMac
178 \value RecordOverflow
179 \value DecompressionFailure
180 \value HandshakeFailure
181 \value NoCertificate
182 \value BadCertificate
183 \value UnsupportedCertificate
184 \value CertificateRevoked
185 \value CertificateExpired
186 \value CertificateUnknown
187 \value IllegalParameter
188 \value UnknownCa
189 \value AccessDenied
190 \value DecodeError
191 \value DecryptError
192 \value ExportRestriction
193 \value ProtocolVersion
194 \value InsufficientSecurity
195 \value InternalError
196 \value InappropriateFallback
197 \value UserCancelled
198 \value NoRenegotiation
199 \value MissingExtension
200 \value UnsupportedExtension
201 \value CertificateUnobtainable
202 \value UnrecognizedName
203 \value BadCertificateStatusResponse
204 \value BadCertificateHashValue
205 \value UnknownPskIdentity
206 \value CertificateRequired
207 \value NoApplicationProtocol
208 \value UnknownAlertMessage
209*/
210
211/*!
212 \enum QSsl::ImplementedClass
213 \brief Enumerates classes that a TLS backend implements
214 \relates QSslSocket
215 \since 6.1
216
217 \ingroup network
218 \ingroup ssl
219 \inmodule QtNetwork
220
221 In QtNetwork, some classes have backend-specific implementation and thus
222 can be left unimplemented. Enumerators in this enum indicate, which class
223 has a working implementation in the backend.
224
225 \value Key Class QSslKey.
226 \value Certificate Class QSslCertificate.
227 \value Socket Class QSslSocket.
228 \value DiffieHellman Class QSslDiffieHellmanParameters.
229 \value EllipticCurve Class QSslEllipticCurve.
230 \value Dtls Class QDtls.
231 \value DtlsCookie Class QDtlsClientVerifier.
232*/
233
234/*!
235 \enum QSsl::SupportedFeature
236 \brief Enumerates possible features that a TLS backend supports
237 \relates QSslSocket
238 \since 6.1
239
240 \ingroup network
241 \ingroup ssl
242 \inmodule QtNetwork
243
244 In QtNetwork TLS-related classes have public API, that may be left unimplemented
245 by some backend, for example, our SecureTransport backend does not support
246 server-side ALPN. Enumerators from SupportedFeature enum indicate that a particular
247 feature is supported.
248
249 \value CertificateVerification Indicates that QSslCertificate::verify() is
250 implemented by the backend.
251 \value ClientSideAlpn Client-side ALPN (Application Layer Protocol Negotiation).
252 \value ServerSideAlpn Server-side ALPN.
253 \value Ocsp OCSP stapling (Online Certificate Status Protocol).
254 \value Psk Pre-shared keys.
255 \value SessionTicket Session tickets.
256 \value Alerts Information about alert messages sent and received.
257*/
258
259QT_END_NAMESPACE
260
261#include "moc_qssl.cpp"
262

source code of qtbase/src/network/ssl/qssl.cpp