QSslKey 類

The QSslKey 類為私鑰和公鑰提供接口。 更多...

頭: #include <QSslKey>
qmake: QT += network
Since: Qt 4.3

注意: 此類的所有函數 可重入 .

公共函數

QSslKey ()
QSslKey (const QByteArray & encoded , QSsl::KeyAlgorithm algorithm , QSsl::EncodingFormat encoding = QSsl::Pem, QSsl::KeyType type = QSsl::PrivateKey, const QByteArray & passPhrase = QByteArray())
QSslKey (QIODevice * device , QSsl::KeyAlgorithm algorithm , QSsl::EncodingFormat encoding = QSsl::Pem, QSsl::KeyType type = QSsl::PrivateKey, const QByteArray & passPhrase = QByteArray())
QSslKey (Qt::HANDLE handle , QSsl::KeyType type = QSsl::PrivateKey)
QSslKey (const QSslKey & other )
~QSslKey ()
QSsl::KeyAlgorithm algorithm () const
void clear ()
Qt::HANDLE handle () const
bool isNull () const
int length () const
void swap (QSslKey & other )
QByteArray toDer (const QByteArray & passPhrase = QByteArray()) const
QByteArray toPem (const QByteArray & passPhrase = QByteArray()) const
QSsl::KeyType type () const
bool operator!= (const QSslKey & other ) const
QSslKey & operator= (QSslKey && other )
QSslKey & operator= (const QSslKey & other )
bool operator== (const QSslKey & other ) const

詳細描述

The QSslKey 類為私鑰和公鑰提供接口。

QSslKey 提供用於管理密鑰的簡單 API。

另請參閱 QSslSocket , QSslCertificate ,和 QSslCipher .

成員函數文檔編製

QSslKey:: QSslKey ()

構造 null 密鑰。

另請參閱 isNull ().

QSslKey:: QSslKey (const QByteArray & encoded , QSsl::KeyAlgorithm algorithm , QSsl::EncodingFormat encoding = QSsl::Pem, QSsl::KeyType type = QSsl::PrivateKey, const QByteArray & passPhrase = QByteArray())

構造 QSslKey by decoding the string in the byte array encoded using a specified algorithm and encoding 格式。 type specifies whether the key is public or private.

If the key is encoded as PEM and encrypted, passPhrase is used to decrypt it.

在構造後,使用 isNull () 以校驗是否 encoded contained a valid key.

QSslKey:: QSslKey ( QIODevice * device , QSsl::KeyAlgorithm algorithm , QSsl::EncodingFormat encoding = QSsl::Pem, QSsl::KeyType type = QSsl::PrivateKey, const QByteArray & passPhrase = QByteArray())

構造 QSslKey by reading and decoding data from a device using a specified algorithm and encoding 格式。 type specifies whether the key is public or private.

If the key is encoded as PEM and encrypted, passPhrase is used to decrypt it.

在構造後,使用 isNull () 以校驗是否 device 提供有效密鑰。

QSslKey:: QSslKey ( Qt::HANDLE handle , QSsl::KeyType type = QSsl::PrivateKey)

構造 QSslKey from a valid native key handle . type specifies whether the key is public or private.

QSslKey will take ownership for this key and you must not free the key using the native library.

該函數在 Qt 5.0 引入。

QSslKey:: QSslKey (const QSslKey & other )

Constructs an identical copy of other .

QSslKey:: ~QSslKey ()

銷毀 QSslKey 對象。

QSsl::KeyAlgorithm QSslKey:: algorithm () const

Returns the key algorithm.

void QSslKey:: clear ()

Clears the contents of this key, making it a null key.

另請參閱 isNull ().

Qt::HANDLE QSslKey:: handle () const

Returns a pointer to the native key handle, if it is available; otherwise a null pointer is returned.

You can use this handle together with the native API to access extended information about the key.

警告: Use of this function has a high probability of being non-portable, and its return value may vary across platforms, and between minor Qt releases.

bool QSslKey:: isNull () const

返迴 true if this is a null key; otherwise false.

另請參閱 clear ().

int QSslKey:: length () const

Returns the length of the key in bits, or -1 if the key is null.

void QSslKey:: swap ( QSslKey & other )

Swaps this ssl key with other 。此函數非常快且從不失敗。

該函數在 Qt 5.0 引入。

QByteArray QSslKey:: toDer (const QByteArray & passPhrase = QByteArray()) const

Returns the key in DER encoding.

The passPhrase argument should be omitted as DER cannot be encrypted. It will be removed in a future version of Qt.

QByteArray QSslKey:: toPem (const QByteArray & passPhrase = QByteArray()) const

Returns the key in PEM encoding. The result is encrypted with passPhrase if the key is a private key and passPhrase is non-empty.

QSsl::KeyType QSslKey:: type () const

返迴密鑰類型 (即:PublicKey 或 PrivateKey)。

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

返迴 true 若此密鑰不等於密鑰 other ;否則返迴 false .

QSslKey &QSslKey:: operator= ( QSslKey && other )

移動賦值運算符。

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

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

Returns a reference to this QSslKey .

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

返迴 true 若此密鑰等於 other ;否則返迴 false .