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