QSslDiffieHellmanParameters Class

The QSslDiffieHellmanParameters class provides an interface for Diffie-Hellman parameters for servers. 更多...

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

注意: 此类的所有函数 可重入 .

公共类型

enum Error { NoError, InvalidInputDataError, UnsafeParametersError }

公共函数

QSslDiffieHellmanParameters ()
QSslDiffieHellmanParameters (const QSslDiffieHellmanParameters & other )
QSslDiffieHellmanParameters (QSslDiffieHellmanParameters && other )
~QSslDiffieHellmanParameters ()
QSslDiffieHellmanParameters::Error error () const
QString errorString () const
bool isEmpty () const
bool isValid () const
void swap (QSslDiffieHellmanParameters & other )
QSslDiffieHellmanParameters & operator= (const QSslDiffieHellmanParameters & other )
QSslDiffieHellmanParameters & operator= (QSslDiffieHellmanParameters && other )

静态公共成员

QSslDiffieHellmanParameters defaultParameters ()
QSslDiffieHellmanParameters fromEncoded (const QByteArray & encoded , QSsl::EncodingFormat encoding = QSsl::Pem)
QSslDiffieHellmanParameters fromEncoded (QIODevice * device , QSsl::EncodingFormat encoding = QSsl::Pem)
size_t qHash (const QSslDiffieHellmanParameters & dhparam , size_t seed = 0)
bool operator!= (const QSslDiffieHellmanParameters & lhs , const QSslDiffieHellmanParameters & rhs )
QDebug operator<< (QDebug debug , const QSslDiffieHellmanParameters & dhparam )
bool operator== (const QSslDiffieHellmanParameters & lhs , const QSslDiffieHellmanParameters & rhs )

详细描述

QSslDiffieHellmanParameters provides an interface for setting Diffie-Hellman parameters to servers based on QSslSocket .

另请参阅 QSslSocket , QSslCipher ,和 QSslConfiguration .

成员类型文档编制

enum QSslDiffieHellmanParameters:: Error

Describes a QSslDiffieHellmanParameters 错误。

常量 描述
QSslDiffieHellmanParameters::NoError 0 没有出现错误。
QSslDiffieHellmanParameters::InvalidInputDataError 1 The given input data could not be used to construct a QSslDiffieHellmanParameters 对象。
QSslDiffieHellmanParameters::UnsafeParametersError 2 The Diffie-Hellman parameters are unsafe and should not be used.

成员函数文档编制

QSslDiffieHellmanParameters:: QSslDiffieHellmanParameters ()

Constructs an empty QSslDiffieHellmanParameters instance.

If an empty QSslDiffieHellmanParameters instance is set on a QSslConfiguration object, Diffie-Hellman negotiation will be disabled.

另请参阅 isValid () 和 QSslConfiguration .

QSslDiffieHellmanParameters:: QSslDiffieHellmanParameters (const QSslDiffieHellmanParameters & other )

Constructs an identical copy of other .

QSslDiffieHellmanParameters:: QSslDiffieHellmanParameters ( QSslDiffieHellmanParameters && other )

Move-constructs from other .

注意: The moved-from object other is placed in a partially-formed state, in which the only valid operations are destruction and assignment of a new value.

QSslDiffieHellmanParameters:: ~QSslDiffieHellmanParameters ()

销毁 QSslDiffieHellmanParameters 对象。

[static] QSslDiffieHellmanParameters QSslDiffieHellmanParameters:: defaultParameters ()

Returns the default QSslDiffieHellmanParameters used by QSslSocket .

This is currently the 1024-bit MODP group from RFC 2459, also known as the Second Oakley Group.

QSslDiffieHellmanParameters::Error QSslDiffieHellmanParameters:: error () const

Returns the error that caused the QSslDiffieHellmanParameters object to be invalid.

QString QSslDiffieHellmanParameters:: errorString () const

Returns a human-readable description of the error that caused the QSslDiffieHellmanParameters object to be invalid.

[static] QSslDiffieHellmanParameters QSslDiffieHellmanParameters:: fromEncoded (const QByteArray & encoded , QSsl::EncodingFormat encoding = QSsl::Pem)

构造 QSslDiffieHellmanParameters object using the byte array encoded in either PEM or DER form as specified by encoding .

使用 isValid () method on the returned object to check whether the Diffie-Hellman parameters were valid and loaded correctly.

另请参阅 isValid () 和 QSslConfiguration .

[static] QSslDiffieHellmanParameters QSslDiffieHellmanParameters:: fromEncoded ( QIODevice * device , QSsl::EncodingFormat encoding = QSsl::Pem)

构造 QSslDiffieHellmanParameters object by reading from device in either PEM or DER form as specified by encoding .

使用 isValid () method on the returned object to check whether the Diffie-Hellman parameters were valid and loaded correctly.

In particular, if device is nullptr or not open for reading, an invalid object will be returned.

另请参阅 isValid () 和 QSslConfiguration .

bool QSslDiffieHellmanParameters:: isEmpty () const

返回 true if this is a an empty QSslDiffieHellmanParameters 实例。

设置空 QSslDiffieHellmanParameters instance on a QSslSocket -based server will disable Diffie-Hellman key exchange.

bool QSslDiffieHellmanParameters:: isValid () const

返回 true if this is a valid QSslDiffieHellmanParameters ;否则 false。

This method should be used after constructing a QSslDiffieHellmanParameters object to determine its validity.

QSslDiffieHellmanParameters object is not valid, you can use the error () method to determine what error prevented the object from being constructed.

另请参阅 error ().

void QSslDiffieHellmanParameters:: swap ( QSslDiffieHellmanParameters & other )

交换此 QSslDiffieHellmanParameters with other 。此函数非常快且从不失败。

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

Copies the contents of other 到此 QSslDiffieHellmanParameters , making the two QSslDiffieHellmanParameters identical.

Returns a reference to this QSslDiffieHellmanParameters .

QSslDiffieHellmanParameters &QSslDiffieHellmanParameters:: operator= ( QSslDiffieHellmanParameters && other )

移动赋值 other 到此 QSslDiffieHellmanParameters 实例。

注意: The moved-from object other is placed in a partially-formed state, in which the only valid operations are destruction and assignment of a new value.

相关非成员

size_t qHash (const QSslDiffieHellmanParameters & dhparam , size_t seed = 0)

Returns an hash value for dhparam ,使用 seed 做计算种子。

bool operator!= (const QSslDiffieHellmanParameters & lhs , const QSslDiffieHellmanParameters & rhs )

返回 true if lhs 不等于 rhs ;否则返回 false .

QDebug operator<< ( QDebug debug , const QSslDiffieHellmanParameters & dhparam )

Writes the set of Diffie-Hellman parameters in dhparam 到 debug 对象 debug 为调试目的。

The Diffie-Hellman parameters will be represented in Base64-encoded DER form.

另请参阅 调试技术 .

bool operator== (const QSslDiffieHellmanParameters & lhs , const QSslDiffieHellmanParameters & rhs )

返回 true if lhs 等于 rhs ;否则返回 false .