pub trait Encrypt {
type Media;
type Config;
type Error;
// Required method
fn encrypt(
&mut self,
media: &mut Self::Media,
cfg: &Self::Config,
) -> Result<(), Self::Error>;
}Expand description
Apply sample protection to a media representation, in place.
The inverse of Decrypt. Self::Config describes the protection scheme
to apply (e.g. cenc/cbcs scheme + key IDs + IV material).
Takes &mut self, not &self: an implementer whose scheme requires
per-sample IV uniqueness per key, for all time (e.g. AES-CTR) generally
cannot make that guarantee across separate calls from a stateless value —
it needs to carry running state (such as a continuing IV counter) forward
from one call to the next. &mut self lets an implementer own that state;
one that needs none is free to ignore the mutability.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".