Skip to main content

Encrypt

Trait Encrypt 

Source
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§

Source

type Media

The in-memory media representation operated on in place.

Source

type Config

The protection scheme configuration to apply.

Source

type Error

The error type this implementer returns.

Required Methods§

Source

fn encrypt( &mut self, media: &mut Self::Media, cfg: &Self::Config, ) -> Result<(), Self::Error>

Encrypt the samples in media in place per cfg.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§