本页内容

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 一起使用,用于配置套接字可使用的加密算法,或向用户显示套接字的加密算法。

另请参阅 QSslSocket 和QSslKey 。

成员函数文档

QSslCipher::QSslCipher()

创建一个空的 QSslCipher 对象。

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

为由name 确定的密码套件构建一个QSslCipher对象。该构造函数仅接受受支持的密码套件(即,name 必须指向QSslSocket::supportedCiphers()返回的密码套件列表中的某个密码套件)。

您可以在构造完成后调用isNull(),以检查name 是否正确识别了一个受支持的加密算法。

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

为由 `name ` 和 `protocol` 确定的加密算法构建一个 `QSslCipher` 对象。该构造函数仅接受受支持的加密算法(即,`name ` 和 `protocol ` 必须指向 `QSslSocket::supportedCiphers()` 返回的加密算法列表中的某个加密算法)。

您可以在实例化后调用 `isNull()` 方法,以检查 `name ` 和 `protocol ` 是否正确指定了受支持的密码套件。

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::UnknownProtocol (protocolString()可能包含更多信息)。

另请参阅 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。

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