1 | // Copyright (C) 2011 Richard J. Moore <rich@kde.org> |
2 | // Copyright (C) 2019 The Qt Company Ltd. |
3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
4 | |
5 | #ifndef QOCSPRESPONSE_H |
6 | #define QOCSPRESPONSE_H |
7 | |
8 | #include <QtNetwork/qtnetworkglobal.h> |
9 | |
10 | #include <QtCore/qshareddata.h> |
11 | #include <QtCore/qmetatype.h> |
12 | #include <QtCore/qobject.h> |
13 | |
14 | #ifndef Q_QDOC |
15 | QT_REQUIRE_CONFIG(ssl); |
16 | #endif |
17 | |
18 | QT_BEGIN_NAMESPACE |
19 | |
20 | enum class QOcspCertificateStatus |
21 | { |
22 | Good, |
23 | Revoked, |
24 | Unknown |
25 | }; |
26 | |
27 | enum class QOcspRevocationReason |
28 | { |
29 | None = -1, |
30 | Unspecified, |
31 | KeyCompromise, |
32 | CACompromise, |
33 | AffiliationChanged, |
34 | Superseded, |
35 | CessationOfOperation, |
36 | CertificateHold, |
37 | RemoveFromCRL |
38 | }; |
39 | |
40 | namespace QTlsPrivate { |
41 | class TlsCryptographOpenSSL; |
42 | } |
43 | |
44 | class QOcspResponse; |
45 | Q_NETWORK_EXPORT size_t qHash(const QOcspResponse &response, size_t seed = 0) noexcept; |
46 | |
47 | class QOcspResponsePrivate; |
48 | class Q_NETWORK_EXPORT QOcspResponse |
49 | { |
50 | public: |
51 | |
52 | QOcspResponse(); |
53 | QOcspResponse(const QOcspResponse &other); |
54 | QOcspResponse(QOcspResponse && other) noexcept; |
55 | ~QOcspResponse(); |
56 | |
57 | QOcspResponse &operator = (const QOcspResponse &other); |
58 | QOcspResponse &operator = (QOcspResponse &&other) noexcept; |
59 | |
60 | QOcspCertificateStatus certificateStatus() const; |
61 | QOcspRevocationReason revocationReason() const; |
62 | |
63 | class QSslCertificate responder() const; |
64 | QSslCertificate subject() const; |
65 | |
66 | void swap(QOcspResponse &other) noexcept { d.swap(other&: other.d); } |
67 | |
68 | private: |
69 | bool isEqual(const QOcspResponse &other) const; |
70 | |
71 | friend class QTlsPrivate::TlsCryptographOpenSSL; |
72 | friend bool operator==(const QOcspResponse &lhs, const QOcspResponse &rhs) |
73 | { return lhs.isEqual(other: rhs); } |
74 | friend bool operator!=(const QOcspResponse &lhs, const QOcspResponse &rhs) |
75 | { return !lhs.isEqual(other: rhs); } |
76 | |
77 | friend Q_NETWORK_EXPORT size_t qHash(const QOcspResponse &response, size_t seed) noexcept; |
78 | |
79 | QSharedDataPointer<QOcspResponsePrivate> d; |
80 | }; |
81 | |
82 | Q_DECLARE_SHARED(QOcspResponse) |
83 | |
84 | QT_END_NAMESPACE |
85 | |
86 | QT_DECL_METATYPE_EXTERN(QOcspResponse, Q_NETWORK_EXPORT) |
87 | |
88 | #endif // QOCSPRESPONSE_H |
89 | |