| 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 QSSLCIPHER_H |
| 7 | #define QSSLCIPHER_H |
| 8 | |
| 9 | #include <QtNetwork/qtnetworkglobal.h> |
| 10 | #include <QtCore/qstring.h> |
| 11 | #include <QtCore/qscopedpointer.h> |
| 12 | #include <QtNetwork/qssl.h> |
| 13 | |
| 14 | #include <memory> |
| 15 | |
| 16 | QT_BEGIN_NAMESPACE |
| 17 | |
| 18 | |
| 19 | #ifndef QT_NO_SSL |
| 20 | |
| 21 | class QSslCipherPrivate; |
| 22 | class Q_NETWORK_EXPORT QSslCipher |
| 23 | { |
| 24 | public: |
| 25 | QSslCipher(); |
| 26 | explicit QSslCipher(const QString &name); |
| 27 | QSslCipher(const QString &name, QSsl::SslProtocol protocol); |
| 28 | QSslCipher(const QSslCipher &other); |
| 29 | QSslCipher &operator=(QSslCipher &&other) noexcept { swap(other); return *this; } |
| 30 | QSslCipher &operator=(const QSslCipher &other); |
| 31 | ~QSslCipher(); |
| 32 | |
| 33 | void swap(QSslCipher &other) noexcept |
| 34 | { d.swap(u&: other.d); } |
| 35 | |
| 36 | bool operator==(const QSslCipher &other) const; |
| 37 | inline bool operator!=(const QSslCipher &other) const { return !operator==(other); } |
| 38 | |
| 39 | bool isNull() const; |
| 40 | QString name() const; |
| 41 | int supportedBits() const; |
| 42 | int usedBits() const; |
| 43 | |
| 44 | QString keyExchangeMethod() const; |
| 45 | QString authenticationMethod() const; |
| 46 | QString encryptionMethod() const; |
| 47 | QString protocolString() const; |
| 48 | QSsl::SslProtocol protocol() const; |
| 49 | |
| 50 | private: |
| 51 | // ### Qt 7: make implicitly shared |
| 52 | std::unique_ptr<QSslCipherPrivate> d; |
| 53 | friend class QTlsBackend; |
| 54 | }; |
| 55 | |
| 56 | Q_DECLARE_SHARED(QSslCipher) |
| 57 | |
| 58 | #ifndef QT_NO_DEBUG_STREAM |
| 59 | class QDebug; |
| 60 | Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslCipher &cipher); |
| 61 | #endif |
| 62 | |
| 63 | #endif // QT_NO_SSL |
| 64 | |
| 65 | QT_END_NAMESPACE |
| 66 | |
| 67 | #endif |
| 68 | |
| 69 | |