Table of Contents
- QSslPreSharedKeyAuthenticator
- Synopsis
- Detailed Description
PySide2.QtNetwork.QSslPreSharedKeyAuthenticator
PySide2.QtNetwork.QSslPreSharedKeyAuthenticator.identity()
PySide2.QtNetwork.QSslPreSharedKeyAuthenticator.identityHint()
PySide2.QtNetwork.QSslPreSharedKeyAuthenticator.maximumIdentityLength()
PySide2.QtNetwork.QSslPreSharedKeyAuthenticator.maximumPreSharedKeyLength()
PySide2.QtNetwork.QSslPreSharedKeyAuthenticator.__ne__()
PySide2.QtNetwork.QSslPreSharedKeyAuthenticator.preSharedKey()
PySide2.QtNetwork.QSslPreSharedKeyAuthenticator.setIdentity()
PySide2.QtNetwork.QSslPreSharedKeyAuthenticator.setPreSharedKey()
PySide2.QtNetwork.QSslPreSharedKeyAuthenticator.swap()
Previous topic
Next topic
Quick search
QSslPreSharedKeyAuthenticator¶
The
QSslPreSharedKeyAuthenticator
class provides authentication data for pre shared keys (PSK) ciphersuites. More…
Synopsis¶
Functions¶
def
__ne__
(, rhs)def
identity
()def
identityHint
()def
maximumIdentityLength
()def
maximumPreSharedKeyLength
()def
preSharedKey
()def
setIdentity
(identity)def
setPreSharedKey
(preSharedKey)def
swap
(other)
Detailed Description¶
The
QSslPreSharedKeyAuthenticator
class is used by an SSL socket to provide the required authentication data in a pre shared key (PSK) ciphersuite.In a PSK handshake, the client must derive a key, which must match the key set on the server. The exact algorithm of deriving the key depends on the application; however, for this purpose, the server may send an identity hint to the client. This hint, combined with other information (for instance a passphrase), is then used by the client to construct the shared key.
The
QSslPreSharedKeyAuthenticator
provides means to client applications for completing the PSK handshake. The client application needs to connect a slot to thepreSharedKeyAuthenticationRequired()
signal:connect(socket, &QSslSocket::preSharedKeyAuthenticationRequired, this, &AuthManager::handlePreSharedKeyAuthentication);The signal carries a
QSslPreSharedKeyAuthenticator
object containing the identity hint the server sent to the client, and which must be filled with the corresponding client identity and the derived key:void AuthManager::handlePreSharedKeyAuthentication(QSslPreSharedKeyAuthenticator *authenticator) { authenticator->setIdentity("My Qt App"); const QByteArray key = deriveKey(authenticator->identityHint(), passphrase); authenticator->setPreSharedKey(key); }Note
PSK ciphersuites are supported only when using OpenSSL 1.0.1 (or greater) as the SSL backend.
Note
PSK is currently only supported in OpenSSL.
See also
- class PySide2.QtNetwork.QSslPreSharedKeyAuthenticator¶
PySide2.QtNetwork.QSslPreSharedKeyAuthenticator(authenticator)
- param authenticator:
Constructs a default
QSslPreSharedKeyAuthenticator
object.The identity hint, the identity and the key will be initialized to empty byte arrays; the maximum length for both the identity and the key will be initialized to 0.
Constructs a
QSslPreSharedKeyAuthenticator
object as a copy ofauthenticator
.See also
operator=()
- PySide2.QtNetwork.QSslPreSharedKeyAuthenticator.identity()¶
- Return type:
Returns the PSK client identity.
See also
- PySide2.QtNetwork.QSslPreSharedKeyAuthenticator.identityHint()¶
- Return type:
Returns the PSK identity hint as provided by the server. The interpretation of this hint is left to the application.
- PySide2.QtNetwork.QSslPreSharedKeyAuthenticator.maximumIdentityLength()¶
- Return type:
int
Returns the maximum length, in bytes, of the PSK client identity.
Note
it is possible to set an identity whose length is greater than ; in this case, only the first bytes will be actually sent to the server.
See also
- PySide2.QtNetwork.QSslPreSharedKeyAuthenticator.maximumPreSharedKeyLength()¶
- Return type:
int
Returns the maximum length, in bytes, of the pre shared key.
Note
it is possible to set a key whose length is greater than the ; in this case, only the first bytes will be actually sent to the server.
See also
- PySide2.QtNetwork.QSslPreSharedKeyAuthenticator.__ne__(rhs)¶
- Parameters:
- Return type:
bool
- PySide2.QtNetwork.QSslPreSharedKeyAuthenticator.preSharedKey()¶
- Return type:
Returns the pre shared key.
See also
- PySide2.QtNetwork.QSslPreSharedKeyAuthenticator.setIdentity(identity)¶
- Parameters:
identity –
PySide2.QtCore.QByteArray
Sets the PSK client identity (to be advised to the server) to
identity
.Note
it is possible to set an identity whose length is greater than
maximumIdentityLength()
; in this case, only the firstmaximumIdentityLength()
bytes will be actually sent to the server.See also
- PySide2.QtNetwork.QSslPreSharedKeyAuthenticator.setPreSharedKey(preSharedKey)¶
- Parameters:
preSharedKey –
PySide2.QtCore.QByteArray
Sets the pre shared key to
preSharedKey
.Note
it is possible to set a key whose length is greater than the
maximumPreSharedKeyLength()
; in this case, only the firstmaximumPreSharedKeyLength()
bytes will be actually sent to the server.See also
preSharedKey()
maximumPreSharedKeyLength()
fromHex()
- PySide2.QtNetwork.QSslPreSharedKeyAuthenticator.swap(other)¶
- Parameters:
Swaps the
QSslPreSharedKeyAuthenticator
objectauthenticator
with this object. This operation is very fast and never fails.
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.