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

source code of qtbase/src/network/ssl/qsslpresharedkeyauthenticator.h