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