QCoapSecurityConfiguration Class
The QCoapSecurityConfiguration class holds configuration options during the authentication process. More...
| Header: | #include <QCoapSecurityConfiguration> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Coap)target_link_libraries(mytarget PRIVATE Qt6::Coap) |
| qmake: | QT += coap |
Public Functions
| QCoapSecurityConfiguration() | |
| QCoapSecurityConfiguration(const QCoapSecurityConfiguration &other) | |
| QCoapSecurityConfiguration(QCoapSecurityConfiguration &&other) | |
| ~QCoapSecurityConfiguration() | |
| QList<QSslCertificate> | caCertificates() const |
| QString | defaultCipherString() const |
| QList<QSslCertificate> | localCertificateChain() const |
| QByteArray | preSharedKey() const |
| QByteArray | preSharedKeyIdentity() const |
| QCoapPrivateKey | privateKey() const |
| void | setCaCertificates(const QList<QSslCertificate> &certificates) |
| void | setDefaultCipherString(const QString &cipherString) |
| void | setLocalCertificateChain(const QList<QSslCertificate> &localChain) |
| void | setPreSharedKey(const QByteArray &preSharedKey) |
| void | setPreSharedKeyIdentity(const QByteArray &identity) |
| void | setPrivateKey(const QCoapPrivateKey &key) |
| void | swap(QCoapSecurityConfiguration &other) |
| QCoapSecurityConfiguration & | operator=(const QCoapSecurityConfiguration &other) |
Detailed Description
It holds information such as client identity, pre shared key, information about certificates, and so on.
Security Considerations
QCoapSecurityConfiguration stores sensitive credential material, such as the pre-shared key, the pre-shared key identity, and the private key, internally using general-purpose data types (QByteArray, QString) that do not guarantee secure erasure of their contents from memory on destruction. This material may persist in freed heap pages, core dumps, swap files, or process memory after a QCoapSecurityConfiguration object is destroyed or cleared. Because these types are implicitly shared, copies of the same secret may exist in several locations and cannot be wiped deterministically.
Provisioning, rotation, and storage of credential material are the responsibility of the application. Applications with strict requirements for credential hygiene should take this into account when deciding how and where to use QCoapSecurityConfiguration.
See also QCoapPrivateKey.
Member Function Documentation
QCoapSecurityConfiguration::QCoapSecurityConfiguration()
Constructs a new QCoapSecurityConfiguration.
QCoapSecurityConfiguration::QCoapSecurityConfiguration(const QCoapSecurityConfiguration &other)
Copies the configuration and state of other.
[noexcept] QCoapSecurityConfiguration::QCoapSecurityConfiguration(QCoapSecurityConfiguration &&other)
Move-constructs a QCoapSecurityConfiguration, making it point to the same object as other was pointing to.
[noexcept] QCoapSecurityConfiguration::~QCoapSecurityConfiguration()
Releases any resources held by QCoapSecurityConfiguration.
QList<QSslCertificate> QCoapSecurityConfiguration::caCertificates() const
Returns this connection's certificate authority certificate database.
See also setCaCertificates().
QString QCoapSecurityConfiguration::defaultCipherString() const
Returns the default cipher string.
See also setDefaultCipherString().
QList<QSslCertificate> QCoapSecurityConfiguration::localCertificateChain() const
Returns the certificate chain to be presented to the peer during the handshake.
See also setLocalCertificateChain().
QByteArray QCoapSecurityConfiguration::preSharedKey() const
Returns the pre shared key.
See also setPreSharedKey().
QByteArray QCoapSecurityConfiguration::preSharedKeyIdentity() const
Returns the PSK client identity.
See also setPreSharedKeyIdentity().
QCoapPrivateKey QCoapSecurityConfiguration::privateKey() const
Returns the private key assigned to the connection.
See also setPrivateKey() and localCertificateChain().
void QCoapSecurityConfiguration::setCaCertificates(const QList<QSslCertificate> &certificates)
Sets certificates as the certificate authority database for the connection.
See also caCertificates().
void QCoapSecurityConfiguration::setDefaultCipherString(const QString &cipherString)
Sets the SSL cipher string to cipherString.
The security back-end (for example OpenSSL) might not include ciphers required for RFC 7252 by default. This method specifies which ciphers the back-end should use. For example to enable CCM ciphers required by RFC, "AESCCM" can be passed as cipherString.
See the OpenSSL docs for more information about cipher strings.
See also defaultCipherString().
void QCoapSecurityConfiguration::setLocalCertificateChain(const QList<QSslCertificate> &localChain)
Sets localChain as the certificate chain to present to the peer during the handshake.
See also localCertificateChain().
void QCoapSecurityConfiguration::setPreSharedKey(const QByteArray &preSharedKey)
Sets the pre shared key to preSharedKey.
See also preSharedKey().
void QCoapSecurityConfiguration::setPreSharedKeyIdentity(const QByteArray &identity)
Sets the PSK client identity (to be advised to the server) to identity.
See also preSharedKeyIdentity().
void QCoapSecurityConfiguration::setPrivateKey(const QCoapPrivateKey &key)
Sets the connection's private key to key.
See also privateKey() and setLocalCertificateChain().
[noexcept] void QCoapSecurityConfiguration::swap(QCoapSecurityConfiguration &other)
Swaps this security configuration with other. This operation is very fast and never fails.
QCoapSecurityConfiguration &QCoapSecurityConfiguration::operator=(const QCoapSecurityConfiguration &other)
Copies the configuration and state of other.
© 2026 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.