Crypto Engines¶
-
class
cryptoshred.engines.CryptoEngine¶ The base class for CryptoEngines. This exists for typing and documentation purposes.
-
decrypt(*, cipher_text, key_id, iv=None)¶ Decrypts a given value
- Parameters
cipher_text (bytes) – The ciphertext to decrypt
key_id (UUID) – The uuid of the key used for encryption. Will be looked up in the key backend
iv (Optional[bytes]) – The initialization vector. Will be looked up in the key backend if not provided
- Return type
bytes- Returns
The decrypted value
-
encrypt(*, data, key_id, iv=None)¶ Encrypt a piece of data.
- Parameters
data (bytes) – The data to encrypt
key_id (UUID) – The uuid of the key used for encryption. Will be looked up in the key backend
iv (Optional[bytes]) – The initialization vector. Will be looked up in the key backend if not provided
- Return type
bytes- Returns
The encrypted value
-
generate_key()¶ Generates a new cryptographic key and stores it in the key backend
- Return type
UUID- Returns
The id of the newly created key
-
-
class
cryptoshred.engines.AesEngine(key_backend)¶ Implements an engine for the AES algorithm in CBC mode.
- Parameters
key_backend (KeyBackend) – The key backend