QSslCipher Class

QSslCipher 类表示 SSL 密码。更多

头文件: #include <QSslCipher>
CMake: find_package(Qt6 REQUIRED COMPONENTS Network)
target_link_libraries(mytarget PRIVATE Qt6::Network)
qmake: QT += network

注意:该类中的所有函数都是可重入的

公共函数

QSslCipher()
QSslCipher(const QString &name)
QSslCipher(const QString &name, QSsl::SslProtocol protocol)
QSslCipher(const QSslCipher &other)
~QSslCipher()
QString authenticationMethod() const
QString encryptionMethod() const
bool isNull() const
QString keyExchangeMethod() const
QString name() const
QSsl::SslProtocol protocol() const
QString protocolString() const
int supportedBits() const
void swap(QSslCipher &other)
int usedBits() const
bool operator!=(const QSslCipher &other) const
QSslCipher &operator=(const QSslCipher &other)
bool operator==(const QSslCipher &other) const

详细说明

QSslCipher 存储一个加密密码的相关信息。它最常用于QSslSocket ,用于配置套接字可使用的密码,或向用户显示套接字的密码。

另请参阅 QSslSocketQSslKey

成员函数文档

QSslCipher::QSslCipher()

构造一个空的 QSslCipher 对象。

[explicit] QSslCipher::QSslCipher(const QString &name)

为由name 确定的密码构造一个 QSslCipher 对象。构造函数只接受受支持的密码(即name 必须在 QSslSocket::supportedCiphers() 返回的密码列表中确定一个密码)。

您可以在构建后调用isNull() 来检查name 是否正确识别了受支持的密码。

QSslCipher::QSslCipher(const QString &name, QSsl::SslProtocol protocol)

为由nameprotocol 确定的密码构造一个 QSslCipher 对象。构造函数只接受受支持的密码(即nameprotocol 必须在 QSslSocket::supportedCiphers() 返回的密码列表中确定一个密码)。

您可以在构建后调用isNull() 来检查nameprotocol 是否正确识别了受支持的密码。

QSslCipher::QSslCipher(const QSslCipher &other)

构建一个与other 密码完全相同的副本。

[noexcept] QSslCipher::~QSslCipher()

销毁QSslCipher 对象。

QString QSslCipher::authenticationMethod() const

QString 的形式返回密码的验证方法。

QString QSslCipher::encryptionMethod() const

QString 的形式返回密码的加密方法。

bool QSslCipher::isNull() const

如果是空密码,则返回true ;否则返回false

QString QSslCipher::keyExchangeMethod() const

QString 的形式返回密码的密钥交换方法。

QString QSslCipher::name() const

返回密码的名称,如果是空密码,则返回空QString

另请参阅 isNull()。

QSsl::SslProtocol QSslCipher::protocol() const

返回密码的协议类型,如果QSslCipher 无法确定协议类型,则返回QSsl::UnknownProtocolprotocolString() 可能包含更多信息)。

另请参见 protocolString()。

QString QSslCipher::protocolString() const

QString 的形式返回密码的协议。

另请参阅 protocol() 。

int QSslCipher::supportedBits() const

返回密码支持的比特数。

另请参见 usedBits()。

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

将此密码实例与other 互换。该操作速度非常快,从未出现过故障。

int QSslCipher::usedBits() const

返回密码使用的比特数。

另请参阅 supportedBits()。

bool QSslCipher::operator!=(const QSslCipher &other) const

如果该密码与other 不同,则返回true ;否则,返回 false。

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

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

bool QSslCipher::operator==(const QSslCipher &other) const

如果该密码与other 相同,则返回true ;否则,返回 false。

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