| 1 | // Copyright (C) 2014 Governikus GmbH & Co. KG. |
|---|---|
| 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 | #ifndef QSSLPRESHAREDKEYAUTHENTICATOR_H |
| 6 | #define QSSLPRESHAREDKEYAUTHENTICATOR_H |
| 7 | |
| 8 | #include <QtNetwork/qtnetworkglobal.h> |
| 9 | #include <QtCore/QString> |
| 10 | #include <QtCore/QSharedDataPointer> |
| 11 | #include <QtCore/QMetaType> |
| 12 | |
| 13 | QT_REQUIRE_CONFIG(ssl); |
| 14 | |
| 15 | QT_BEGIN_NAMESPACE |
| 16 | |
| 17 | class QSslPreSharedKeyAuthenticatorPrivate; |
| 18 | class QSslPreSharedKeyAuthenticator |
| 19 | { |
| 20 | Q_GADGET_EXPORT(Q_NETWORK_EXPORT) |
| 21 | public: |
| 22 | Q_NETWORK_EXPORT QSslPreSharedKeyAuthenticator(); |
| 23 | Q_NETWORK_EXPORT ~QSslPreSharedKeyAuthenticator(); |
| 24 | Q_NETWORK_EXPORT QSslPreSharedKeyAuthenticator(const QSslPreSharedKeyAuthenticator &authenticator); |
| 25 | Q_NETWORK_EXPORT QSslPreSharedKeyAuthenticator &operator=(const QSslPreSharedKeyAuthenticator &authenticator); |
| 26 | |
| 27 | QSslPreSharedKeyAuthenticator &operator=(QSslPreSharedKeyAuthenticator &&other) noexcept { swap(other); return *this; } |
| 28 | |
| 29 | void swap(QSslPreSharedKeyAuthenticator &other) noexcept { d.swap(other&: other.d); } |
| 30 | |
| 31 | Q_NETWORK_EXPORT QByteArray identityHint() const; |
| 32 | |
| 33 | Q_NETWORK_EXPORT void setIdentity(const QByteArray &identity); |
| 34 | Q_NETWORK_EXPORT QByteArray identity() const; |
| 35 | Q_NETWORK_EXPORT int maximumIdentityLength() const; |
| 36 | |
| 37 | Q_NETWORK_EXPORT void setPreSharedKey(const QByteArray &preSharedKey); |
| 38 | Q_NETWORK_EXPORT QByteArray preSharedKey() const; |
| 39 | Q_NETWORK_EXPORT int maximumPreSharedKeyLength() const; |
| 40 | |
| 41 | private: |
| 42 | Q_NETWORK_EXPORT bool isEqual(const QSslPreSharedKeyAuthenticator &other) const; |
| 43 | |
| 44 | friend class QTlsBackend; |
| 45 | |
| 46 | friend bool operator==(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs) |
| 47 | { return lhs.isEqual(other: rhs); } |
| 48 | friend bool operator!=(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs) |
| 49 | { return !lhs.isEqual(other: rhs); } |
| 50 | |
| 51 | QSharedDataPointer<QSslPreSharedKeyAuthenticatorPrivate> d; |
| 52 | }; |
| 53 | |
| 54 | |
| 55 | Q_DECLARE_SHARED(QSslPreSharedKeyAuthenticator) |
| 56 | |
| 57 | QT_END_NAMESPACE |
| 58 | |
| 59 | QT_DECL_METATYPE_EXTERN(QSslPreSharedKeyAuthenticator, Q_NETWORK_EXPORT) |
| 60 | QT_DECL_METATYPE_EXTERN_TAGGED(QSslPreSharedKeyAuthenticator*, QSslPreSharedKeyAuthenticator_ptr, Q_NETWORK_EXPORT) |
| 61 | |
| 62 | #endif // QSSLPRESHAREDKEYAUTHENTICATOR_H |
| 63 |
