QSslDiffieHellmanParameters Class

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

头文件: #include <QSslDiffieHellmanParameters>
qmake: QT += network
开始支持版本: Qt 5.8

Note: All functions in this class are reentrant.

公有类型

enum Error { NoError, InvalidInputDataError, UnsafeParametersError }

公有函数

QSslDiffieHellmanParameters()
QSslDiffieHellmanParameters(const QSslDiffieHellmanParameters &other)
QSslDiffieHellmanParameters(QSslDiffieHellmanParameters &&other)
~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)
uint qHash(const QSslDiffieHellmanParameters &dhparam, uint seed = 0)
QDebug operator<<(QDebug debug, const QSslDiffieHellmanParameters &dhparam)
bool operator==(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanParameters &rhs)

详细描述

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

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

参见 QSslSocket, QSslCipher, and QSslConfiguration.

成员类型

enum QSslDiffieHellmanParameters::Error

Describes a QSslDiffieHellmanParameters error.

ConstantValueDescription
QSslDiffieHellmanParameters::NoError0No error occurred.
QSslDiffieHellmanParameters::InvalidInputDataError1The given input data could not be used to construct a QSslDiffieHellmanParameters object.
QSslDiffieHellmanParameters::UnsafeParametersError2The 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() and QSslConfiguration.

QSslDiffieHellmanParameters::QSslDiffieHellmanParameters(const QSslDiffieHellmanParameters &other)

Constructs an identical copy of other.

QSslDiffieHellmanParameters::QSslDiffieHellmanParameters(QSslDiffieHellmanParameters &&other)

Move-copy constructor.

QSslDiffieHellmanParameters::~QSslDiffieHellmanParameters()

Destroys the QSslDiffieHellmanParameters object.

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

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)

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

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

参见 isValid() and QSslConfiguration.

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

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

Use the 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() and QSslConfiguration.

bool QSslDiffieHellmanParameters::isEmpty() const

Returns true if this is a an empty QSslDiffieHellmanParameters instance.

Setting an empty QSslDiffieHellmanParameters instance on a QSslSocket-based server will disable Diffie-Hellman key exchange.

bool QSslDiffieHellmanParameters::isValid() const

Returns true if this is a valid QSslDiffieHellmanParameters; otherwise false.

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

If a 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)

Swaps this QSslDiffieHellmanParameters with other. This function is very fast and never fails.

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

Copies the contents of other into this QSslDiffieHellmanParameters, making the two QSslDiffieHellmanParameters identical.

Returns a reference to this QSslDiffieHellmanParameters.

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

Move-assigns other to this QSslDiffieHellmanParameters instance.

Note: 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.

相关非成员

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

Returns an hash value for dhparam, using seed to seed the calculation.

This function was introduced in Qt 5.8.

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

Writes the set of Diffie-Hellman parameters in dhparam into the debug object debug for debugging purposes.

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

This function was introduced in Qt 5.8.

参见 Debugging Techniques.

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

Returns true if lhs is equal to rhs; otherwise returns false.

This function was introduced in Qt 5.8.