Crate pssh_box

Source
Expand description

Parsing and serialization support for pssh boxes, as used in DRM systems.

This crate defines Rust data structures allowing you to store, parse and serialize Protection System Specific Header (PSSH) boxes, which provide data for the initialization of a Digital Rights Management (DRM) system. PSSH boxes are used:

  • in an MP4 box of type pssh in an MP4 fragment (CMAF/MP4/ISOBMFF containers)

  • in a <cenc:pssh> element in a DASH MPD manifest

  • in DRM initialization data passed to the Encrypted Media Extension of a web browser

  • in an EXT-X-SESSION-KEY field of an m3u8 playlist.

A PSSH box includes information for a single DRM system. This library supports the PSSH data formats for the following DRM systems:

  • Widevine, owned by Google, widely used for DASH streaming
  • PlayReady, owned by Microsoft, widely used for DASH streaming
  • WisePlay, owned by Huawei
  • Irdeto
  • Marlin
  • Nagra
  • FairPlay (the unofficial version used by Netflix)
  • Common Encryption

PSSH boxes contain (depending on the DRM system) information on the key_ID for which to obtain a content key, the encryption scheme used (e.g. cenc, cbc1, cens or cbcs), the URL of the licence server, and checksum data.

Modules§

irdeto
Definitions for PSSH data in the Irdeto DRM system.
nagra
Definitions for PSSH data in the Nagra DRM system.
playready
Definitions for PSSH data in the PlayReady DRM system.
widevine
Definitions for PSSH data in the Widevine DRM system.
wiseplay
Definitions for PSSH data in the WisePlay DRM system.

Structs§

DRMKeyId
The Content Key or default_KID.
DRMSystemId
The identifier for a DRM system.
PsshBox
A PSSH box, also called a ProtectionSystemSpecificHeaderBox in ISO 23001-7:2012.
PsshBoxVec

Enums§

PsshData
Data in a PSSH box whose format is dependent on the DRM system used.

Constants§

CENC_SYSTEM_ID
COMMON_SYSTEM_ID
FAIRPLAYNFLX_SYSTEM_ID
IRDETO_SYSTEM_ID
MARLIN_SYSTEM_ID
NAGRA_SYSTEM_ID
PLAYREADY_SYSTEM_ID
WIDEVINE_SYSTEM_ID
WISEPLAY_SYSTEM_ID

Traits§

ToBytes

Functions§

find_iter
Locate the positions of a PsshBox in a buffer, if present. Returns an iterator over start positions for PSSH boxes in the buffer.
from_base64
Parse one or more PSSH boxes from some initialization data encoded in base64 format.
from_buffer
Read one or more PSSH boxes from a slice of octets, stopping (but not returning an error) when non-PSSH data is found in the slice. An error is returned if the parsing fails.
from_bytes
Read one or more PSSH boxes from some initialization data provided as a slice of octets, returning an error if any non-PSSH data is found in the slice or if the parsing fails.
from_hex
Parse one or more PSSH boxes from some initialization data encoded in hex format.
pprint
Multiline pretty printing of a PsshBox (verbose alternative to to_string() method).
version
The version of this crate.