pub trait Decryptable<E> {
// Provided methods
fn decrypt(key: &Key, encrypted: &E) -> Result<Self, CryptError>
where E: Ciphertext + Nonce,
Self: ProstDecode { ... }
fn decrypt_with_cipher(
cipher: &XChaCha20Poly1305,
encrypted: &E,
) -> Result<Self, CryptError>
where E: Ciphertext + Nonce,
Self: ProstDecode { ... }
}Expand description
Decryptable from data structures that include nonces.
This is the main decryption trait for data structures that carry their own nonce, providing a convenient interface for symmetric decryption.
Provided Methods§
Sourcefn decrypt(key: &Key, encrypted: &E) -> Result<Self, CryptError>where
E: Ciphertext + Nonce,
Self: ProstDecode,
fn decrypt(key: &Key, encrypted: &E) -> Result<Self, CryptError>where
E: Ciphertext + Nonce,
Self: ProstDecode,
Decrypt using a key and encrypted data that includes its own nonce.
Sourcefn decrypt_with_cipher(
cipher: &XChaCha20Poly1305,
encrypted: &E,
) -> Result<Self, CryptError>where
E: Ciphertext + Nonce,
Self: ProstDecode,
fn decrypt_with_cipher(
cipher: &XChaCha20Poly1305,
encrypted: &E,
) -> Result<Self, CryptError>where
E: Ciphertext + Nonce,
Self: ProstDecode,
Decrypt using a pre-initialized cipher instance.
Useful when you already have a cipher instance and want to avoid the overhead of re-creating it.