Functions#
generate_key#
generate_key[A: Algorithm](algorithm) -> Effect[Key[A], CryptoError]A key of random bytes from SecureRandom.
| Parameter | Type | Description |
|---|---|---|
algorithm | A |
Returns Effect[Key[A], CryptoError]
def generate_key[A: Algorithm](self, algorithm: A) -> Effect[Key[A], CryptoError]:
"""A key of random bytes from ``SecureRandom``."""
...encrypt#
encrypt(key, plaintext, *, iv) -> Effect[bytes, CryptoError]The ciphertext of plaintext under key and the 16-byte iv.
| Parameter | Type | Description |
|---|---|---|
key | Key[Any] | |
plaintext | Binary | |
iv | Binary |
Returns Effect[bytes, CryptoError]
def encrypt(
self, key: Key[Any], plaintext: Binary, *, iv: Binary
) -> Effect[bytes, CryptoError]:
"""The ciphertext of ``plaintext`` under ``key`` and the 16-byte ``iv``."""
...decrypt#
decrypt(key, ciphertext, *, iv) -> Effect[bytes, CryptoError]The plaintext; AES-CBC fails a bad padding or length with
DecryptionFailed, AES-CTR never fails.
| Parameter | Type | Description |
|---|---|---|
key | Key[Any] | |
ciphertext | Binary | |
iv | Binary |
Returns Effect[bytes, CryptoError]
def decrypt(
self, key: Key[Any], ciphertext: Binary, *, iv: Binary
) -> Effect[bytes, CryptoError]:
"""The plaintext; AES-CBC fails a bad padding or length with
``DecryptionFailed``, AES-CTR never fails."""
...