openssh_key.cipher.common.Cipher¶
- class openssh_key.cipher.common.Cipher¶
Bases:
abc.ABCAn abstract symmetric-key cipher.
Used to encrypt and decrypt private plaintext bytes of a length that is a multiple of a cipher-specific block size, given a key and an initialization vector.
- __init__()¶
Methods
__init__()decrypt(kdf, passphrase, cipher_bytes)Decrypts the given ciphertext bytes using the given options of a key derivation function and the given passphrase to derive the encryption key.
encrypt(kdf, passphrase, plain_bytes)Encrypts the given plaintext bytes using the given options of a key derivation function and the given passphrase to derive the encryption key.
The block size for this cipher.
Attributes
The block size for this cipher.
- BLOCK_SIZE = 0¶
The block size for this cipher.
- abstract classmethod decrypt(kdf, passphrase, cipher_bytes)¶
Decrypts the given ciphertext bytes using the given options of a key derivation function and the given passphrase to derive the encryption key.
- Parameters
kdf (
KDFOptions) – The options of a key derivation function.passphrase (
str) – The passphrase from which the cipher key is derived.cipher_bytes (
bytes) – Ciphertext bytes to be decrypted.
- Return type
- Returns
Plaintext bytes.
- abstract classmethod encrypt(kdf, passphrase, plain_bytes)¶
Encrypts the given plaintext bytes using the given options of a key derivation function and the given passphrase to derive the encryption key.
- Parameters
kdf (
KDFOptions) – The options of a key derivation function.passphrase (
str) – The passphrase from which the cipher key is derived.plain_bytes (
bytes) – Plaintext bytes to be encrypted.
- Return type
- Returns
Ciphertext bytes.