QSslKey Class Reference

[ QtNetwork module]

The QSslKey class provides an interface for private and public keys. 更多...

方法

Special Methods


详细描述

The QSslKey class provides an interface for private and public keys.

QSslKey provides a simple API for managing keys.


方法文档编制

QSslKey.__init__ ( self )

Constructs a null key.

另请参阅 isNull ().

QSslKey.__init__ ( self , QByteArray   encoded , QSsl.KeyAlgorithm   algorithm , QSsl.EncodingFormat   encoding  = QSsl.Pem, QSsl.KeyType   type  = QSsl.PrivateKey, QByteArray   passPhrase  = QByteArray())

构造 QSslKey by decoding the string in the byte array encoded using a specified algorithm and encoding format. If the encoded key is encrypted, passPhrase is used to decrypt it. type specifies whether the key is public or private.

After construction, use isNull () to check if encoded contained a valid key.

QSslKey.__init__ ( self , QIODevice   device , QSsl.KeyAlgorithm   algorithm , QSsl.EncodingFormat   encoding  = QSsl.Pem, QSsl.KeyType   type  = QSsl.PrivateKey, QByteArray   passPhrase  = QByteArray())

构造 QSslKey by reading and decoding data from a device using a specified algorithm and encoding format. If the encoded key is encrypted, passPhrase is used to decrypt it. type specifies whether the key is public or private.

After construction, use isNull () to check if device provided a valid key.

QSslKey.__init__ ( self , QSslKey   other )

Constructs an identical copy of other .

QSsl.KeyAlgorithm QSslKey.algorithm ( self )

Returns the key algorithm.

QSslKey.clear ( self )

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

另请参阅 isNull ().

sip.voidptr QSslKey.handle ( self )

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 ( self )

Returns true if this is a null key; otherwise false.

另请参阅 clear ().

int QSslKey.length ( self )

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

QByteArray QSslKey.toDer ( self , QByteArray   passPhrase  = QByteArray())

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

QByteArray QSslKey.toPem ( self , QByteArray   passPhrase  = QByteArray())

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 ( self )

Returns the type of the key (i.e., PublicKey or PrivateKey).

bool QSslKey.__eq__ ( self , QSslKey   key )

bool QSslKey.__ne__ ( self , QSslKey   key )