QCoapPrivateKey Class

The QCoapPrivateKey class provides an interface for managing CoAP security keys. More...

Header: #include <QCoapPrivateKey>
CMake: find_package(Qt6 REQUIRED COMPONENTS Coap)
target_link_libraries(mytarget PRIVATE Qt6::Coap)
qmake: QT += coap

Public Functions

QCoapPrivateKey()
QCoapPrivateKey(const QByteArray &key, QSsl::KeyAlgorithm algorithm, QSsl::EncodingFormat format = QSsl::Pem, const QByteArray &passPhrase = QByteArray())
QCoapPrivateKey(const Qt::HANDLE &handle)
QCoapPrivateKey(const QCoapPrivateKey &other)
QCoapPrivateKey(QCoapPrivateKey &&other)
~QCoapPrivateKey()
QSsl::KeyAlgorithm algorithm() const
QSsl::EncodingFormat encodingFormat() const
Qt::HANDLE handle() const
bool isNull() const
QByteArray key() const
QByteArray passPhrase() const
void swap(QCoapPrivateKey &other)
QCoapPrivateKey &operator=(const QCoapPrivateKey &other)

Detailed Description

A QCoapPrivateKey packages a private key used in negotiating CoAP connections securely. It holds the information required for authentication using pre-shared keys and X.509 certificates.

Member Function Documentation

QCoapPrivateKey::QCoapPrivateKey()

Constructs an empty instance of QCoapPrivateKey.

QCoapPrivateKey::QCoapPrivateKey(const QByteArray &key, QSsl::KeyAlgorithm algorithm, QSsl::EncodingFormat format = QSsl::Pem, const QByteArray &passPhrase = QByteArray())

Constructs a QCoapPrivateKey from the byte array key using the specified algorithm and encoding format.

If the key is encrypted then passPhrase is required to decrypt it.

QCoapPrivateKey::QCoapPrivateKey(const Qt::HANDLE &handle)

Constructs a QCoapPrivateKey from a native key handle.

QCoapPrivateKey::QCoapPrivateKey(const QCoapPrivateKey &other)

Copies the contents of other into this key, making the two keys identical.

[noexcept] QCoapPrivateKey::QCoapPrivateKey(QCoapPrivateKey &&other)

Move-constructs a QCoapPrivateKey, making it point to the same object as other was pointing to.

[noexcept] QCoapPrivateKey::~QCoapPrivateKey()

Releases any resources held by QCoapPrivateKey.

QSsl::KeyAlgorithm QCoapPrivateKey::algorithm() const

Returns the key algorithm.

QSsl::EncodingFormat QCoapPrivateKey::encodingFormat() const

Returns the encoding format of the key.

Qt::HANDLE QCoapPrivateKey::handle() const

Returns a pointer to the native key handle.

bool QCoapPrivateKey::isNull() const

Returns true if the private key is null, returns false otherwise.

QByteArray QCoapPrivateKey::key() const

Returns the encoded private key.

QByteArray QCoapPrivateKey::passPhrase() const

Returns the passphrase for the key.

[noexcept] void QCoapPrivateKey::swap(QCoapPrivateKey &other)

Swaps this private key with other. This operation is very fast and never fails.

QCoapPrivateKey &QCoapPrivateKey::operator=(const QCoapPrivateKey &other)

Copies the contents of other into this key, making the two keys identical.

Returns a reference to this QCoapPrivateKey.

© 2024 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.