mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-02 05:55:08 +00:00
fix(drm): stop a bridged FairPlay track whose server-CDM answer or licence key does not decrypt it
This commit is contained in:
@@ -1262,6 +1262,7 @@ A slow answer arrives as a [slow response](#slow-responses).
|
||||
| `clear_tracks` (response) | Requested track ids that carry no DRM, so they have no keys. Absent when every requested track is encrypted. |
|
||||
| `file_keys` (response) | Content keys of whole-file ciphers, by track id, for a single track and for a batch. Absent when no requested track holds such a cipher. |
|
||||
| `vault_keys` (response) | KIDs whose content key came from a server vault, not the CDM. The client proves such a content key with a decode before it trusts it; the field is absent when every content key came from the CDM. |
|
||||
| `bridge_kids` (response) | For a batch: the KIDs of the init segments of each FairPlay-only track that the server licensed through the FairPlay bridge, by track id. The client needs the content key of each of these KIDs, or the download of that track stops. Absent when the batch has no such track. |
|
||||
|
||||
| Status | Error code | Meaning |
|
||||
| --- | --- | --- |
|
||||
|
||||
@@ -550,7 +550,9 @@ The download reads the key ID from the init segment, builds a DRM object for tha
|
||||
the service on the server has the hook. The server reads the same key ID at the licence step, accepts
|
||||
the DRM object of the client and sends the challenge to the hook of its service. A server that cannot
|
||||
read the key ID refuses the challenge. A licence that gives no content key stops the track before it
|
||||
downloads a segment.
|
||||
downloads a segment. With the server CDM, the batch licence names the key IDs that the server read, so an
|
||||
answer without their content keys stops the track in the same way. A content key that does not decode
|
||||
the downloaded track stops the track with an error, and unshackle keeps no output file.
|
||||
|
||||
unshackle reads one key ID from each init segment. So it licenses a playlist that changes its content key
|
||||
correctly only when each content key has its own init segment with a real `tenc` key ID, after an
|
||||
|
||||
@@ -87,6 +87,8 @@ appropriate one for each track.
|
||||
`Left out 1 FairPlay-only track: EXAMPLE has no FairPlay bridge hook`. When only FairPlay-only tracks
|
||||
match your quality or range options, unshackle skips the title, unless you use `--best-available`.
|
||||
`--list` still shows every track.
|
||||
A licence without the content key of a key ID, or with a content key that does not decrypt the
|
||||
track, stops the download of that track with an error, and unshackle keeps no output file.
|
||||
|
||||
When each `EXT-X-KEY` of an fMP4 playlist is sample encryption
|
||||
for a DRM system that unshackle cannot license, such as FairPlay, unshackle reads the key ID from
|
||||
|
||||
@@ -298,6 +298,11 @@ Each command reports how many files it removed and how much space it freed, then
|
||||
|
||||
**Inspect:** while it decrypts a track whose content key came from a vault, unshackle keeps the ciphertext as a `.enc` sibling of the track file in the temp directory, and removes it afterwards; a leftover one is from a killed run and is safe to delete. Read the `bad_keys` table of your local SQLite vault to see which pairs are flagged and which vault each came from. See [Wrong keys from a poisoned vault](vaults.md#wrong-keys-from-a-poisoned-vault).
|
||||
|
||||
!!! example "A FairPlay-only track stops after its licence"
|
||||
**Symptom:** the download of a FairPlay-only track stops with `No content key for KID <kid> of track <id>`, `No Content Key for KID <kid> was returned by the server CDM`, or `The licence content key of KID <kid> does not decrypt track <id>`, and unshackle keeps no output file.
|
||||
|
||||
**Inspect:** the licence server gave no content key for a key ID of the init segments, or gave a PlayReady or Widevine content key that is not the FairPlay one. unshackle flags a content key that does not decode. The next licence of that key ID clears the flag, so each run licenses and checks the key again. Operate unshackle with `-d` and read the `Key check on` debug line for the result of each window. See [DRM & CDM](drm-and-cdm.md).
|
||||
|
||||
!!! example "A network request fails at the connection or TLS layer"
|
||||
**Symptom:** timeouts, connection resets, or handshake errors, and unshackle's own logs do not give the full cause.
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ unshackle pushes keys from every source, not only a local CDM. A run against a r
|
||||
|
||||
### Wrong keys from a poisoned vault
|
||||
|
||||
A public vault can return the right KID with a wrong content key. The decrypters accept a wrong content key and write noise. unshackle therefore trusts a content key from a vault only after FFmpeg decodes the decrypted track with strict error detection. For a fragmented MP4, unshackle reads from the encrypted file which fragments each KID encrypts, and FFmpeg decodes up to three windows of each KID: from its first, middle and last fragment on through the next fragments of that KID, for up to 4 seconds. A window never runs into a fragment of another KID or a clear fragment. A clear lead or a lead under another KID therefore cannot hide a wrong content key, and only the KID that fails is flagged. When every KID in the map has a content key, the map is complete, and a KID that is not in it does not encrypt this file. This file does not judge that KID; the file of its own track judges it. A file with no encrypted sample entry and no encrypted fragment, for example a clear audio track, judges no KID, so it neither flags nor copies a content key. A KID that is not in an incomplete map, for example one with an all-zero KID, and every KID of any other file, gets one check of the whole file. FFmpeg decodes the first seconds and the last seconds. A failure there flags each of those KIDs. When a mapped KID fails, the KIDs that are not in the map get no verdict from that pass; the retry with the replaced key judges them. Content keys from a licence skip this check. A file this FFmpeg build cannot judge counts as a pass, never as a wrong content key: a codec it has no decoder for, or a header it cannot read. A pass is not proof. A wrong content key for HEVC video can decode without an error for some seconds, most often at a low resolution, and that content key passes the check. Without FFmpeg there is no check at all.
|
||||
A public vault can return the right KID with a wrong content key. The decrypters accept a wrong content key and write noise. unshackle therefore trusts a content key from a vault only after FFmpeg decodes the decrypted track with strict error detection. For a fragmented MP4, unshackle reads from the encrypted file which fragments each KID encrypts, and FFmpeg decodes up to three windows of each KID: from its first, middle and last fragment on through the next fragments of that KID, for up to 4 seconds. A window never runs into a fragment of another KID or a clear fragment. A clear lead or a lead under another KID therefore cannot hide a wrong content key, and only the KID that fails is flagged. When every KID in the map has a content key, the map is complete, and a KID that is not in it does not encrypt this file. This file does not judge that KID; the file of its own track judges it. A file with no encrypted sample entry and no encrypted fragment, for example a clear audio track, judges no KID, so it neither flags nor copies a content key. A KID that is not in an incomplete map, for example one with an all-zero KID, and every KID of any other file, gets one check of the whole file. FFmpeg decodes the first seconds and the last seconds. A failure there flags each of those KIDs. When a mapped KID fails, the KIDs that are not in the map get no verdict from that pass; the retry with the replaced key judges them. Content keys from a licence skip this check, except those of a FairPlay-only track that the FairPlay bridge licensed. When one of these fails, unshackle flags the pair, stops the track and keeps no output file. A file this FFmpeg build cannot judge counts as a pass, never as a wrong content key: a codec it has no decoder for, or a header it cannot read. A pass is not proof. A wrong content key for HEVC video can decode without an error for some seconds, most often at a low resolution, and that content key passes the check. Without FFmpeg there is no check at all.
|
||||
|
||||
When the decode fails, unshackle:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user