Skip to main content

Crate sheathe_crypto

Crate sheathe_crypto 

Source
Expand description

Common Encryption (ISO/IEC 23001-7) for sheathe.

Mirrors Shaka Packager’s media/crypto: the CENC protection schemes plus a sample Encryptor that applies them. Two schemes are implemented on top of a pure-Rust AES-128 block cipher:

  • cenc — AES-128 CTR. The keystream runs continuously across a sample’s protected byte ranges (clear ranges do not advance the counter).
  • cbcs — AES-128 CBC with pattern encryption (crypt 1 block, skip 9), CBC chaining reset to the constant IV at the start of each subsample; a trailing partial block (< 16 bytes) is left in the clear.

Encryption operates on a list of Subsample (clear/protected byte runs), so the caller (the MP4 muxer) decides the NAL-aware clear/protected split; this crate stays format-agnostic.

Structs§

ContentKey
A content key plus its 16-byte Key ID (KID).
Encryptor
An AES-128 sample encryptor bound to one content key.
Subsample
A contiguous run within a sample: clear plaintext bytes followed by protected bytes to encrypt.

Enums§

Scheme
A CENC protection scheme (the schm scheme_type).