QSslKey

PyQt5.QtNetwork.QSslKey

Description

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

QSslKey provides a simple API for managing keys.

Methods

__init__()

Constructs a null key.

See also

isNull().


__init__(QSslKey)

Constructs an identical copy of other.


__init__(sip.voidptr, type: KeyType = PrivateKey)

TODO


__init__(Union[QByteArray, bytes, bytearray], KeyAlgorithm, encoding: EncodingFormat = Pem, type: KeyType = PrivateKey, passPhrase: Union[QByteArray, bytes, bytearray] = QByteArray())

Constructs a QSslKey by decoding the string in the byte array encoded using a specified algorithm and encoding format. type specifies whether the key is public or private.

If the key is encrypted then passPhrase is used to decrypt it.

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


__init__(QIODevice, KeyAlgorithm, encoding: EncodingFormat = Pem, type: KeyType = PrivateKey, passPhrase: Union[QByteArray, bytes, bytearray] = QByteArray())

Constructs a QSslKey by reading and decoding data from a device using a specified algorithm and encoding format. type specifies whether the key is public or private.

If the key is encrypted then passPhrase is used to decrypt it.

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


algorithm() → KeyAlgorithm

Returns the key algorithm.


clear()

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

See also

isNull().


__eq__(QSslKey) → bool

TODO


handle() → sip.voidptr

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.

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


isNull() → bool

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

See also

clear().


length() → int

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


__ne__(QSslKey) → bool

TODO


swap(QSslKey)

TODO


toDer(passPhrase: Union[QByteArray, bytes, bytearray] = QByteArray()) → QByteArray

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.


toPem(passPhrase: Union[QByteArray, bytes, bytearray] = QByteArray()) → 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.


type() → KeyType

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