![]() |
CopperSpice API
1.9.2
|
The QSslPreSharedKeyAuthenticator class provides authentication data for pre shared keys (PSK) ciphersuites. More...
Public Methods | |
QSslPreSharedKeyAuthenticator () | |
QSslPreSharedKeyAuthenticator (const QSslPreSharedKeyAuthenticator &other) | |
~QSslPreSharedKeyAuthenticator () | |
QByteArray | identity () const |
QByteArray | identityHint () const |
int | maximumIdentityLength () const |
int | maximumPreSharedKeyLength () const |
QSslPreSharedKeyAuthenticator & | operator= (const QSslPreSharedKeyAuthenticator &other) |
QSslPreSharedKeyAuthenticator & | operator= (QSslPreSharedKeyAuthenticator &&other) |
QByteArray | preSharedKey () const |
void | setIdentity (const QByteArray &identity) |
void | setPreSharedKey (const QByteArray &preSharedKey) |
void | swap (QSslPreSharedKeyAuthenticator &other) |
Friends | |
bool | operator== (const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs) |
Related Functions | |
These are not member functions | |
bool | operator!= (const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs) |
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.
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.
QSslPreSharedKeyAuthenticator::QSslPreSharedKeyAuthenticator | ( | const QSslPreSharedKeyAuthenticator & | other | ) |
Copy constructs a new QSslPreSharedKeyAuthenticator from other.
QSslPreSharedKeyAuthenticator::~QSslPreSharedKeyAuthenticator | ( | ) |
Destroys the QSslPreSharedKeyAuthenticator object.
QByteArray QSslPreSharedKeyAuthenticator::identity | ( | ) | const |
Returns the PSK client identity.
QByteArray QSslPreSharedKeyAuthenticator::identityHint | ( | ) | const |
Returns the PSK identity hint as provided by the server. The interpretation of this hint is left to the application.
int QSslPreSharedKeyAuthenticator::maximumIdentityLength | ( | ) | const |
Returns the maximum length, in bytes, of the PSK client identity.
int QSslPreSharedKeyAuthenticator::maximumPreSharedKeyLength | ( | ) | const |
Returns the maximum length, in bytes, of the pre shared key.
QSslPreSharedKeyAuthenticator & QSslPreSharedKeyAuthenticator::operator= | ( | const QSslPreSharedKeyAuthenticator & | other | ) |
Copy assigns from other and returns a reference to this object.
|
inline |
Move assigns from other and returns a reference to this object.
QByteArray QSslPreSharedKeyAuthenticator::preSharedKey | ( | ) | const |
Returns the pre shared key.
void QSslPreSharedKeyAuthenticator::setIdentity | ( | const QByteArray & | identity | ) |
Sets the PSK client identity (to be advised to the server) to identity.
void QSslPreSharedKeyAuthenticator::setPreSharedKey | ( | const QByteArray & | preSharedKey | ) |
Sets the pre shared key to preSharedKey.
|
inline |
Swaps other with this QSslPreSharedKeyAuthenticator object. This operation is very fast and never fails.
|
related |
Returns true if the authenticator object lhs is different than rhs, otherwise it returns false.
|
friend |
Returns true if the authenticator object lhs is equal to rhs, otherwise it returns false.
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.