![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
The QSslPreSharedKeyAuthenticator class provides authentication data for pre shared keys (PSK) ciphersuites. More...
#include <qsslpresharedkeyauthenticator.h>
Public Member Functions | |
Q_NETWORK_EXPORT | QSslPreSharedKeyAuthenticator () |
Constructs a default QSslPreSharedKeyAuthenticator object. | |
Q_NETWORK_EXPORT | ~QSslPreSharedKeyAuthenticator () |
Destroys the QSslPreSharedKeyAuthenticator object. | |
Q_NETWORK_EXPORT | QSslPreSharedKeyAuthenticator (const QSslPreSharedKeyAuthenticator &authenticator) |
Constructs a QSslPreSharedKeyAuthenticator object as a copy of authenticator. | |
Q_NETWORK_EXPORT QSslPreSharedKeyAuthenticator & | operator= (const QSslPreSharedKeyAuthenticator &authenticator) |
Assigns the QSslPreSharedKeyAuthenticator object authenticator to this object, and returns a reference to the copy. | |
QSslPreSharedKeyAuthenticator & | operator= (QSslPreSharedKeyAuthenticator &&other) noexcept |
Move-assigns the QSslPreSharedKeyAuthenticator object authenticator to this object, and returns a reference to the moved instance. | |
void | swap (QSslPreSharedKeyAuthenticator &other) noexcept |
\memberswap{authenticator} | |
Q_NETWORK_EXPORT QByteArray | identityHint () const |
Returns the PSK identity hint as provided by the server. | |
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 | identity () const |
Returns the PSK client identity. | |
Q_NETWORK_EXPORT int | maximumIdentityLength () const |
Returns the maximum length, in bytes, of the PSK client identity. | |
Q_NETWORK_EXPORT void | setPreSharedKey (const QByteArray &preSharedKey) |
Sets the pre shared key to preSharedKey. | |
Q_NETWORK_EXPORT QByteArray | preSharedKey () const |
Returns the pre shared key. | |
Q_NETWORK_EXPORT int | maximumPreSharedKeyLength () const |
Returns the maximum length, in bytes, of the pre shared key. |
Friends | |
class | QTlsBackend |
bool | operator== (const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs) |
bool | operator!= (const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs) |
The QSslPreSharedKeyAuthenticator class provides authentication data for pre shared keys (PSK) ciphersuites.
\inmodule QtNetwork
\reentrant
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 the QSslSocket::preSharedKeyAuthenticationRequired() signal:
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:
Definition at line 18 of file qsslpresharedkeyauthenticator.h.
QSslPreSharedKeyAuthenticator::QSslPreSharedKeyAuthenticator | ( | ) |
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.
Definition at line 77 of file qsslpresharedkeyauthenticator.cpp.
QSslPreSharedKeyAuthenticator::~QSslPreSharedKeyAuthenticator | ( | ) |
Destroys the QSslPreSharedKeyAuthenticator object.
Definition at line 85 of file qsslpresharedkeyauthenticator.cpp.
QSslPreSharedKeyAuthenticator::QSslPreSharedKeyAuthenticator | ( | const QSslPreSharedKeyAuthenticator & | authenticator | ) |
Constructs a QSslPreSharedKeyAuthenticator object as a copy of authenticator.
Definition at line 94 of file qsslpresharedkeyauthenticator.cpp.
QByteArray QSslPreSharedKeyAuthenticator::identity | ( | ) | const |
Returns the PSK client identity.
Definition at line 149 of file qsslpresharedkeyauthenticator.cpp.
QByteArray QSslPreSharedKeyAuthenticator::identityHint | ( | ) | const |
Returns the PSK identity hint as provided by the server.
The interpretation of this hint is left to the application.
Definition at line 125 of file qsslpresharedkeyauthenticator.cpp.
int QSslPreSharedKeyAuthenticator::maximumIdentityLength | ( | ) | const |
Returns the maximum length, in bytes, of the PSK client identity.
Definition at line 164 of file qsslpresharedkeyauthenticator.cpp.
int QSslPreSharedKeyAuthenticator::maximumPreSharedKeyLength | ( | ) | const |
Returns the maximum length, in bytes, of the pre shared key.
Definition at line 203 of file qsslpresharedkeyauthenticator.cpp.
QSslPreSharedKeyAuthenticator & QSslPreSharedKeyAuthenticator::operator= | ( | const QSslPreSharedKeyAuthenticator & | authenticator | ) |
Assigns the QSslPreSharedKeyAuthenticator object authenticator to this object, and returns a reference to the copy.
Definition at line 103 of file qsslpresharedkeyauthenticator.cpp.
|
inlinenoexcept |
Move-assigns the QSslPreSharedKeyAuthenticator object authenticator to this object, and returns a reference to the moved instance.
Definition at line 27 of file qsslpresharedkeyauthenticator.h.
References swap().
QByteArray QSslPreSharedKeyAuthenticator::preSharedKey | ( | ) | const |
Returns the pre shared key.
Definition at line 189 of file qsslpresharedkeyauthenticator.cpp.
void QSslPreSharedKeyAuthenticator::setIdentity | ( | const QByteArray & | identity | ) |
Sets the PSK client identity (to be advised to the server) to identity.
Definition at line 139 of file qsslpresharedkeyauthenticator.cpp.
void QSslPreSharedKeyAuthenticator::setPreSharedKey | ( | const QByteArray & | preSharedKey | ) |
Sets the pre shared key to preSharedKey.
Definition at line 179 of file qsslpresharedkeyauthenticator.cpp.
|
inlinenoexcept |
\memberswap{authenticator}
Definition at line 29 of file qsslpresharedkeyauthenticator.h.
Referenced by operator=().
|
friend |
Returns true
if the authenticator object lhs is not equal to rhs; false
otherwise.
Definition at line 48 of file qsslpresharedkeyauthenticator.h.
|
friend |
Returns true
if the authenticator object lhs is equal to rhs; false
otherwise.
Two authenticator objects are equal if and only if they have the same identity hint, identity, pre shared key, maximum length for the identity and maximum length for the pre shared key.
Definition at line 46 of file qsslpresharedkeyauthenticator.h.
|
friend |
Definition at line 44 of file qsslpresharedkeyauthenticator.h.