Expand description
Random access to the files of encrypted (crypt) libraries, for players that
stream and seek.
A media file is stored as a header, the encrypted thumbnail, then the encrypted
data (redseat-crypto, AES-256-CBC with PKCS#7 padding and the media’s IV). The
server serves the data part with range requests (redseat_rust docs/MEDIA_FILES.md).
CBC decrypts any block on its own: plaintext block i is AES-decrypt(C[i]) XOR C[i-1], with the media’s IV before block 0. So EncryptedMediaReader::read_at
fetches only the blocks it needs and the one before them.
The decryption goes through redseat-crypto’s one-shot functions. Those check the PKCS#7 padding, which only the last block of the data has: blocks from the middle of the data get a padding block appended, encrypted from their last block with the key, so they decrypt to exactly their plaintext.
Structs§
- Encrypted
Media Reader - Reads the plaintext of an encrypted media by ranges. Get one with
LibraryApi::open_encrypted_media. Cheap to clone.