Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
src_network_ssl_qsslpresharedkeyauthenticator.cpp
Go to the documentation of this file.
1// Copyright (C) 2018 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
6 this, &AuthManager::handlePreSharedKeyAuthentication);
8
10 void AuthManager::handlePreSharedKeyAuthentication(QSslPreSharedKeyAuthenticator *authenticator)
11 {
12 authenticator->setIdentity("My Qt App");
13
14 const QByteArray key = deriveKey(authenticator->identityHint(), passphrase);
15 authenticator->setPreSharedKey(key);
16 }
\inmodule QtCore
Definition qbytearray.h:57
The QSslPreSharedKeyAuthenticator class provides authentication data for pre shared keys (PSK) cipher...
Q_NETWORK_EXPORT void setIdentity(const QByteArray &identity)
Sets the PSK client identity (to be advised to the server) to identity.
Q_NETWORK_EXPORT QByteArray identityHint() const
Returns the PSK identity hint as provided by the server.
Q_NETWORK_EXPORT void setPreSharedKey(const QByteArray &preSharedKey)
Sets the pre shared key to preSharedKey.
void preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator *authenticator)
GLuint64 key
QTcpSocket * socket
[1]
connect(socket, &QSslSocket::preSharedKeyAuthenticationRequired, this, &AuthManager::handlePreSharedKeyAuthentication)
[0]