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, *, nonce, aad=None) -> Effect[bytes, CryptoError]The ciphertext followed by its 16-byte tag.
| Parameter | Type | Description |
|---|---|---|
key | Key[Any] | |
plaintext | Binary | |
nonce | Binary | |
aad | Binary | None = None |
Returns Effect[bytes, CryptoError]
def encrypt(
self, key: Key[Any], plaintext: Binary, *, nonce: Binary, aad: Binary | None = None
) -> Effect[bytes, CryptoError]:
"""The ciphertext followed by its 16-byte tag."""
...decrypt#
decrypt(key, ciphertext, *, nonce, aad=None) -> Effect[bytes, CryptoError]The plaintext; DecryptionFailed for any authentication failure.
| Parameter | Type | Description |
|---|---|---|
key | Key[Any] | |
ciphertext | Binary | |
nonce | Binary | |
aad | Binary | None = None |
Returns Effect[bytes, CryptoError]
def decrypt(
self, key: Key[Any], ciphertext: Binary, *, nonce: Binary, aad: Binary | None = None
) -> Effect[bytes, CryptoError]:
"""The plaintext; ``DecryptionFailed`` for any authentication failure."""
...