getKeysFromEntitlement

suspend fun getKeysFromEntitlement(sessionId: ByteString, entitledPssh: PSSH): List<Key>

Unwrap the content keys carried by an ENTITLED_KEY PSSH.

Entitlement licensing splits delivery in two: a first license carries ENTITLEMENT keys, and a later ENTITLED_KEY PSSH carries content keys each wrapped with one of them. Each WidevinePsshData.EntitledKey names its wrapping key by entitlement_key_id and supplies the AES-CBC iv.

The session must already have parsed a license containing the matching ENTITLEMENT keys; getKeys returns those, this returns the content keys they unlock.

Return

the unwrapped content keys, which are not added to the session

Parameters

entitledPssh

a PSSH whose CENC header is of type ENTITLED_KEY

Throws

if the session id is invalid

if the session holds no ENTITLEMENT keys

if the PSSH carries no entitled keys

if an entitled key is missing a required field

if no entitlement key matches an entitled key