QCoapPrivateKey Class

QCoapPrivateKey 类为管理 CoAP 安全密钥提供了一个接口。更多

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

公共函数

QCoapPrivateKey()
QCoapPrivateKey(const Qt::HANDLE &handle)
QCoapPrivateKey(const QByteArray &key, QSsl::KeyAlgorithm algorithm, QSsl::EncodingFormat format = QSsl::Pem, const QByteArray &passPhrase = QByteArray())
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)

详细说明

QCoapPrivateKey 包含用于安全协商 CoAP 连接的私钥。它包含使用pre-shared 密钥和 X.509 证书进行身份验证所需的信息。

成员函数文档

QCoapPrivateKey::QCoapPrivateKey()

构造 QCoapPrivateKey 的空实例。

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

从本地密钥handle 构造 QCoapPrivateKey。

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

使用指定的algorithm 和编码format 从字节数组key 构造一个 QCoapPrivateKey。

如果密钥已加密,则需要passPhrase 来解密。

QCoapPrivateKey::QCoapPrivateKey(const QCoapPrivateKey &other)

other 中的内容复制到此密钥中,使两个密钥完全相同。

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

Move-构建一个 QCoapPrivateKey,使其指向与other 指向相同的对象。

[noexcept] QCoapPrivateKey::~QCoapPrivateKey()

释放QCoapPrivateKey 持有的任何资源。

QSsl::KeyAlgorithm QCoapPrivateKey::algorithm() const

返回密钥算法。

QSsl::EncodingFormat QCoapPrivateKey::encodingFormat() const

返回密钥的编码格式。

Qt::HANDLE QCoapPrivateKey::handle() const

返回指向本地键句柄的指针。

bool QCoapPrivateKey::isNull() const

如果私钥为空,则返回true ,否则返回false

QByteArray QCoapPrivateKey::key() const

返回编码后的私人密钥。

QByteArray QCoapPrivateKey::passPhrase() const

返回密钥的口令。

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

将此私人密钥与other 互换。这一操作速度非常快,从未出现过故障。

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

other 的内容复制到此密钥中,使两个密钥完全相同。

返回对QCoapPrivateKey 的引用。

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