pub trait BlockCipherMode<C: BlockCipher> {
type Mode: CipherMode;
type Nonce: AsRef<[u8]> + AsMut<[u8]> + Clone;
// Required methods
fn new(cipher: C, nonce: &Self::Nonce) -> Result<Self>
where Self: Sized;
fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>>;
fn decrypt(&self, ciphertext: &[u8]) -> Result<Vec<u8>>;
fn generate_nonce<R: RngCore + CryptoRng>(rng: &mut R) -> Self::Nonce;
// Provided method
fn mode_name() -> &'static str { ... }
}
Expand description
Trait for block cipher modes with type parameters
Required Associated Types§
Sourcetype Mode: CipherMode
type Mode: CipherMode
The mode this implementation uses
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.