PySide6.QtOpcUa.QOpcUaKeyPair¶
- class QOpcUaKeyPair¶
- QOpcUaKeyPairhandles private and public key pairs. More…- Synopsis¶- Methods¶- def - __init__()
- def - generateRsaKey()
- def - hasPrivateKey()
- def - type()
 - Signals¶- Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Detailed Description¶- This class is currently available as a Technology Preview, and therefore the API and functionality provided by the class may be subject to change at any time without prior notice. - It can generate, load and store keys for asymmetric encryption. Instances of this class have to be passed to functions which need a key. - class RsaKeyStrength¶
- This enum type specifies the strength of a RSA key. - Constant - Description - QOpcUaKeyPair.RsaKeyStrength.Bits1024 - A key strength of 1024 bits. - QOpcUaKeyPair.RsaKeyStrength.Bits2048 - A key strength of 2048 bits. - QOpcUaKeyPair.RsaKeyStrength.Bits4096 - A key strength of 4096 bits. 
 - class KeyType¶
- This enum type specifies the type of a key. - Constant - Description - QOpcUaKeyPair.KeyType.Rsa - An RSA key - QOpcUaKeyPair.KeyType.Empty - No key is available. - QOpcUaKeyPair.KeyType.Unknown - The type of key is not handled. 
 - class Cipher¶
- Ciphers for encryption of private keys. - Constant - Description - QOpcUaKeyPair.Cipher.Aes128Cbc - Encrypting AES128 with CBC - QOpcUaKeyPair.Cipher.Unencrypted - The Key will not be encrypted. 
 - Creates a new empty key pair with - parentas the parent object.- generateRsaKey(strength)¶
- Parameters:
- strength – - RsaKeyStrength
 
 - Generates a new asymmetric RSA key pair. - The length of the key is specified by - strength.- hasPrivateKey()¶
- Return type:
- bool 
 
 - Returns - trueif the current key contains a private key, otherwise- false.- loadFromPemData(data)¶
- Parameters:
- data – - QByteArray
- Return type:
- bool 
 
 - Loads a key from PEM encoded data in - data. Returns- trueon success and- falseotherwise.- It detects from the PEM header if the data contains a private or public key. Loading encrypted keys is possible by connecting a function to the signal - passphraseNeededfor provision of the passphrase.- passphraseNeeded(passphrase, maximumLength, writeOperation)¶
- Parameters:
- passphrase – str 
- maximumLength – int 
- writeOperation – bool 
 
 
 - This signal is emitted when a private key needs a - passphrasefor encryption or decryption.- writeOperationis- truewhen the passphrase is needed for exporting a key, and is- falsewhen the passphrase is needed for importing a key.- maximumLengthspecifies the maximum length in bytes for the passphrase. All characters in- passphraseexceeding this limit will be ignored.- In case you have use this signal crossing thread boundaries you have to connect it with - Qt::BlockingQueuedConnection.- Returns the PEM encoded private key. In case there is no private key, an empty byte array is returned. - The encryption of the key has to be specified using the parameters - cipherand- password. In order to store the key unencrypted the cipher- Cipher::Unencryptedhas to be used.- publicKeyToByteArray()¶
- Return type:
 
 - Returns the public key as a byte array. - Returns the type of the current key.