QSslKeyingMaterial Class

Describes exported keying material derived from a TLS session. More...

Header: #include <QSslKeyingMaterial>
CMake: find_package(Qt6 REQUIRED COMPONENTS Network)
target_link_libraries(mytarget PRIVATE Qt6::Network)
qmake: QT += network
Since: Qt 6.12

Note: All functions in this class are reentrant.

QSslKeyingMaterial Comparisons

CategoryComparable Types
equalityQSslKeyingMaterial

Public Functions

size_t qHash(const QSslKeyingMaterial &key)
size_t qHash(const QSslKeyingMaterial &key, size_t seed)
QDebug operator<<(QDebug debug, const QSslKeyingMaterial &keying)

Detailed Description

QSslKeyingMaterial represents a request for keying material derived from an established TLS connection using the TLS exporter mechanism.

The exporter mechanism is defined in RFC 5705 for TLS 1.2 and earlier and in RFC 8446 for TLS 1.3. It allows applications to derive cryptographically separate keying material from the TLS session without exposing the session's traffic keys.

Each QSslKeyingMaterial object specifies:

  • an exporter label identifying the purpose of the derived keying material
  • an optional context value binding the keying material to application-specific data
  • the desired size of the exported keying material

The actual keying material is derived by the TLS backend after a successful handshake and can be retrieved via value().

QSslKeyingMaterial objects are typically configured via QSslConfiguration::setKeyingMaterial() before initiating a TLS connection.

Example: Deterministic export on client and server

 // Both client and server configure the same label and optional context
 QSslKeyingMaterial keying("session-label", 32, "app-specific-context");

 // After the TLS handshake completes get data from QSslConfiguration.
 QByteArray derived = sslConfiguration().keyingMaterial(keying)->value();

 // Both client and server will obtain the same 'derived' bytes
 // even though they each performed the derivation independently.
 qDebug() << "Derived keying material:" << derived;

Member Function Documentation

[constexpr noexcept default] QSslKeyingMaterial::QSslKeyingMaterial()

Default-constructs an instance of QSslKeyingMaterial.

Related Non-Members

[noexcept] size_t qHash(const QSslKeyingMaterial &key)

[noexcept] size_t qHash(const QSslKeyingMaterial &key, size_t seed)

Returns the hash value for key, using seed to seed the calculation.

QDebug operator<<(QDebug debug, const QSslKeyingMaterial &keying)

Writes a textual representation of the keying material keying to the debug object debug.

See also Debugging Techniques.