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