Functions#
generate_key#
generate_key[A: AesKw](algorithm) -> Effect[Key[A], CryptoError]An AES-KW key of random bytes from SecureRandom.
| Parameter | Type | Description |
|---|---|---|
algorithm | A |
Returns Effect[Key[A], CryptoError]
def generate_key[A: AesKw](self, algorithm: A) -> Effect[Key[A], CryptoError]:
"""An AES-KW key of random bytes from ``SecureRandom``."""
...generate_key_pair#
generate_key_pair[A: RsaOaep](algorithm) -> Effect[KeyPair[A], CryptoError]A new RSA-OAEP key pair.
| Parameter | Type | Description |
|---|---|---|
algorithm | A |
Returns Effect[KeyPair[A], CryptoError]
def generate_key_pair[A: RsaOaep](self, algorithm: A) -> Effect[KeyPair[A], CryptoError]:
"""A new RSA-OAEP key pair."""
...wrap#
wrap(wrap_key, key) -> Effect[bytes, CryptoError]key wrapped under wrap_key (an AES-KW key, or an RSA-OAEP
public key).
| Parameter | Type | Description |
|---|---|---|
wrap_key | WrapKey | |
key | SecretKey |
Returns Effect[bytes, CryptoError]
def wrap(self, wrap_key: WrapKey, key: SecretKey) -> Effect[bytes, CryptoError]:
"""``key`` wrapped under ``wrap_key`` (an AES-KW key, or an RSA-OAEP
public key)."""
...unwrap#
unwrap[A: aead.Algorithm](unwrap_key: UnwrapKey, algorithm: A, wrapped: Binary) -> Effect[aead.Key[A], CryptoError]
unwrap[A: cipher.Algorithm](unwrap_key: UnwrapKey, algorithm: A, wrapped: Binary) -> Effect[cipher.Key[A], CryptoError]
unwrap[A: mac.Algorithm](unwrap_key: UnwrapKey, algorithm: A, wrapped: Binary) -> Effect[mac.Key[A], CryptoError]
unwrap[A: AesKw](unwrap_key: UnwrapKey, algorithm: A, wrapped: Binary) -> Effect[Key[A], CryptoError]A key of algorithm from wrapped; DecryptionFailed
when it does not unwrap.
| Parameter | Type | Description |
|---|---|---|
unwrap_key | ||
algorithm | ||
wrapped |
@overload
def unwrap[A: aead.Algorithm](
self, unwrap_key: UnwrapKey, algorithm: A, wrapped: Binary
) -> Effect[aead.Key[A], CryptoError]: ...
@overload
def unwrap[A: cipher.Algorithm](
self, unwrap_key: UnwrapKey, algorithm: A, wrapped: Binary
) -> Effect[cipher.Key[A], CryptoError]: ...
@overload
def unwrap[A: mac.Algorithm](
self, unwrap_key: UnwrapKey, algorithm: A, wrapped: Binary
) -> Effect[mac.Key[A], CryptoError]: ...
@overload
def unwrap[A: AesKw](
self, unwrap_key: UnwrapKey, algorithm: A, wrapped: Binary
) -> Effect[Key[A], CryptoError]: ...
def unwrap(
self, unwrap_key: UnwrapKey, algorithm: SecretAlgorithm, wrapped: Binary
) -> Effect[Any, CryptoError]:
"""A key of ``algorithm`` from ``wrapped``; ``DecryptionFailed``
when it does not unwrap."""
...