Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsslerror.h
Go to the documentation of this file.
1// Copyright (C) 2016 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#ifndef QSSLERROR_H
7#define QSSLERROR_H
8
9#include <QtNetwork/qtnetworkglobal.h>
10#include <QtCore/qdebug.h>
11#include <QtCore/qvariant.h>
12#include <QtNetwork/qsslcertificate.h>
13
14#include <memory>
15
17
18
19#ifndef QT_NO_SSL
20
21#ifndef QT_NO_DEBUG_STREAM
22class QDebug;
23#endif
24
25class QSslErrorPrivate;
26class Q_NETWORK_EXPORT QSslError
27{
28 Q_GADGET
29public:
30 enum SslError {
31 NoError,
32 UnableToGetIssuerCertificate,
33 UnableToDecryptCertificateSignature,
34 UnableToDecodeIssuerPublicKey,
35 CertificateSignatureFailed,
36 CertificateNotYetValid,
37 CertificateExpired,
38 InvalidNotBeforeField,
39 InvalidNotAfterField,
40 SelfSignedCertificate,
41 SelfSignedCertificateInChain,
42 UnableToGetLocalIssuerCertificate,
43 UnableToVerifyFirstCertificate,
44 CertificateRevoked,
45 InvalidCaCertificate,
46 PathLengthExceeded,
47 InvalidPurpose,
48 CertificateUntrusted,
49 CertificateRejected,
50 SubjectIssuerMismatch, // hostname mismatch?
51 AuthorityIssuerSerialNumberMismatch,
52 NoPeerCertificate,
53 HostNameMismatch,
54 NoSslSupport,
55 CertificateBlacklisted,
56 CertificateStatusUnknown,
57 OcspNoResponseFound,
58 OcspMalformedRequest,
59 OcspMalformedResponse,
60 OcspInternalError,
61 OcspTryLater,
62 OcspSigRequred,
63 OcspUnauthorized,
64 OcspResponseCannotBeTrusted,
65 OcspResponseCertIdUnknown,
66 OcspResponseExpired,
67 OcspStatusUnknown,
68 UnspecifiedError = -1
69 };
70 Q_ENUM(SslError)
71
72 // RVCT compiler in debug build does not like about default values in const-
73 // So as an workaround we define all constructor overloads here explicitly
74 QSslError();
75 explicit QSslError(SslError error);
76 QSslError(SslError error, const QSslCertificate &certificate);
77
78 QSslError(const QSslError &other);
79
80 void swap(QSslError &other) noexcept
81 { d.swap(other.d); }
82
83 ~QSslError();
84 QSslError &operator=(QSslError &&other) noexcept { swap(other); return *this; }
85 QSslError &operator=(const QSslError &other);
86 bool operator==(const QSslError &other) const;
87 inline bool operator!=(const QSslError &other) const
88 { return !(*this == other); }
89
90 SslError error() const;
91 QString errorString() const;
92 QSslCertificate certificate() const;
93
94private:
95 // ### Qt 7: make QSslError implicitly shared
96 std::unique_ptr<QSslErrorPrivate> d;
97#ifndef QT_NO_DEBUG_STREAM
98 Q_NETWORK_EXPORT friend QDebug print(QDebug debug, QSslError::SslError error);
99 friend QDebug operator<<(QDebug debug, SslError error)
100 { return print(std::move(debug), error); }
101#endif
102};
104
105Q_NETWORK_EXPORT size_t qHash(const QSslError &key, size_t seed = 0) noexcept;
106
107#ifndef QT_NO_DEBUG_STREAM
108
109Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslError &error);
110#if QT_NETWORK_REMOVED_SINCE(6, 8)
111Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslError::SslError &error);
112#endif
113#endif
114#else
115class Q_NETWORK_EXPORT QSslError {}; // dummy class so that moc has a complete type
116#endif // QT_NO_SSL
117
118QT_END_NAMESPACE
119
120#ifndef QT_NO_SSL
121QT_DECL_METATYPE_EXTERN_TAGGED(QList<QSslError>, QList_QSslError, Q_NETWORK_EXPORT)
122#endif
123
124#endif
Definition qlist.h:80
This class represents Online Certificate Status Protocol response.
The QSslCertificate class provides a convenient API for an X509 certificate.
The QSslCipher class represents an SSL cryptographic cipher.
Definition qsslcipher.h:23
The QSslDiffieHellmanParameters class provides an interface for Diffie-Hellman parameters for servers...
Represents an elliptic curve for use by elliptic-curve cipher algorithms.
constexpr QSslEllipticCurve() noexcept
Constructs an invalid elliptic curve.
constexpr bool isValid() const noexcept
Returns true if this elliptic curve is a valid curve, false otherwise.
friend constexpr bool operator!=(QSslEllipticCurve lhs, QSslEllipticCurve rhs) noexcept
Q_NETWORK_EXPORT bool isTlsNamedCurve() const noexcept
Returns true if this elliptic curve is one of the named curves that can be used in the key exchange w...
friend constexpr bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) noexcept
The QSslError class provides an SSL error.
Definition qsslerror.h:27
The QSslKey class provides an interface for private and public keys.
Definition qsslkey.h:24
The QSslPreSharedKeyAuthenticator class provides authentication data for pre shared keys (PSK) cipher...
The QSslSocket class provides an SSL encrypted socket for both clients and servers.
Definition qsslsocket.h:30
QTlsBackend is a factory class, providing implementations for the QSsl classes.
TlsKey is an abstract class, that allows a TLS plugin to provide an underlying implementation for the...
X509Certificate is an abstract class that allows a TLS backend to provide an implementation of the QS...
Namespace containing onternal types that TLS backends implement.
bool(*)(QIODevice *device, QSslKey *key, QSslCertificate *cert, QList< QSslCertificate > *caCertificates, const QByteArray &passPhrase) X509Pkcs12ReaderPtr
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2568
static QT_BEGIN_NAMESPACE QString msgUnsupportedMulticastAddress()
Definition qdtls.cpp:304
Q_DECLARE_INTERFACE(QNetworkAccessBackendFactory, QNetworkAccessBackendFactory_iid)
QOcspRevocationReason
QT_REQUIRE_CONFIG(thread)
constexpr size_t qHash(QSslEllipticCurve curve, size_t seed=0) noexcept
Q_DECLARE_TYPEINFO(QSslEllipticCurve, Q_PRIMITIVE_TYPE)
#define QTlsBackend_iid