PSSH

class PSSH

Helper for parsing and building PSSH (Protection System Specific Header) boxes. Supports both Widevine and PlayReady headers and provides conversions.

Constructors

Link copied to clipboard
constructor(data: String, strict: Boolean = false)

Create from a Base64-encoded PSSH box, Widevine CENC header, or PlayReady header.

constructor(data: ByteArray, strict: Boolean = false)

Create from raw bytes of a PSSH box, Widevine CENC header, or PlayReady header.

constructor(systemId: ByteArray, version: Int, flags: Int, keyIds: List<Uuid>, content: ByteArray)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Crypto period this header names, for content using key rotation, or null.

Link copied to clipboard

Duration of each crypto period in seconds, for content using key rotation, or null.

Link copied to clipboard

Encryption scheme this header declares, e.g. AESCTR or AESCBC, or null when the header does not say.

Link copied to clipboard

Raw init data contained within the PSSH box.

Functions

Link copied to clipboard

Export the PSSH object as a full PSSH box in bytes form.

Link copied to clipboard

Export the PSSH object as a full PSSH box in Base64 form.

Link copied to clipboard
fun keyIds(): List<Uuid>

Get all Key IDs from within the Box or Init Data, wherever possible.

Link copied to clipboard

Point this PSSH at a specific crypto period.

Link copied to clipboard
fun setKeyIds(keyIds: List<Uuid>)

Overwrite the Key IDs of this box.

Link copied to clipboard
fun setKeyIdsAny(keyIds: List<Any>)

Overload that accepts a mixed list of UUID | String(hex/base64) | ByteArray.

Link copied to clipboard
fun toPlayready(laUrl: String? = null, luiUrl: String? = null, dsId: ByteArray? = null, decryptorSetup: String? = null, customData: String? = null)

Convert a Widevine PSSH to a PlayReady v4.3.0.0 PSSH. Optional LA_URL/LUI_URL/DS_ID/DECRYPTORSETUP/CUSTOMDATA fields can be provided.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Convert PlayReady PSSH to a Widevine PSSH.