Skip to main content

iso_cenc/
error.rs

1//! Crypto errors (`thiserror`).
2
3#![forbid(unsafe_code)]
4
5use thiserror::Error;
6
7/// `ClearKey` / CENC sample crypto error.
8#[derive(Debug, Clone, PartialEq, Eq, Error)]
9#[non_exhaustive]
10pub enum Error {
11    /// Subsample clear+protected lengths exceed the sample buffer.
12    #[error("subsample ranges exceed sample length")]
13    SubsampleOverflow,
14    /// Pattern encryption requested for a scheme that forbids it.
15    #[error("pattern is not valid for this protection scheme")]
16    InvalidPattern,
17    /// IV / key size mismatch for the scheme.
18    #[error("invalid key or iv length")]
19    InvalidKeyMaterial,
20}