QSslCipher Class

QSslCipher 类提供了 SSL 密钥的支持。

属性 方法
头文件 #include <QSslCipher>
qmake QT += network
引入 Qt 4.3

该类最早在 Qt 4.3版本引入。

注意: 所有的函数都是可重入的。

公共成员函数

属性 方法
QSslCipher(const QSslCipher &other)
QSslCipher(const QString &name, QSsl::SslProtocol protocol)
QSslCipher(const QString &name)
QSslCipher()
QSslCipher & operator=(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
bool operator==(const QSslCipher &other) const

详细描述

QSslCipher 储存着一个密钥的信息。该类型的对象通常被 QSslSocket 用来指定某套接字可以使用哪种密钥或者展现某套接字所使用的密钥。

另外您也可以在 QSslSocketQSslKey 类文档中找到相关信息。

成员函数文档

QSslCipher::QSslCipher(const QSslCipher &other)

拷贝构造函数。由 other 拷贝出一个相同的 QSslCipher 对象。


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

构造函数。通过鉴定 nameprotocol 来构造一个 QSslCipher 对象来储存密钥信息。该构造函数仅接受受支持的密钥(即您指定的 nameprotocol 所鉴定出的密钥必须位于 QSslSocket::supportedCiphers() 函数返回的列表中)。

构造后,您可以调用 isNull() 函数检查 nameprotocol 是否能正确地鉴定出一个支持的密钥。


QSslCipher::QSslCipher(const QString &name)

构造函数。通过判断 name 参数构造一个 QSslCipher 对象储存密钥信息。该构造函数仅接受受支持的密钥(即您指定的 name 所鉴定出的密钥必须位于 QSslSocket::supportedCiphers() 函数返回的列表中)。

构造后,可以调用 isNull() 函数检查 name 是否正确标识了受支持的密码。

该函数最初在 Qt 5.3 版本中引入。


QSslCipher::QSslCipher()

构造函数。构造一个空的 QSslCipher 对象。


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

other 的内容拷贝到等式左值,是两个密钥相同。


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() 函数介绍中找到相关信息。


void QSslCipher::swap(QSslCipher &other)

other 快速交换密钥信息。该函数操作速度飞快并保证操作成功。

该函数最初在 Qt 5.0 版本引入。


int QSslCipher::usedBits() const

返回密钥所用的字节数。

另外您也可以在 supportedBits() 函数介绍中找到相关信息。


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

如果当前密钥与 other 不同则返回 true ,否则返回 false


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

如果当前密钥与 other 相同则返回 true ,否则返回 false