Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect EXT-X-KEY data uri value in generated HLS playlist for KEYFORMAT="identity" #1219

Open
mmilitzer opened this issue Jun 20, 2023 · 0 comments
Labels
component: HLS The issue involves HLS output flag: good first issue This might be a relatively easy issue; good for new contributors flag: seeking PR We are actively seeking PRs for this; we do not currently expect the core team will resolve this

Comments

@mmilitzer
Copy link

System info

Operating System: Fedora 37
Shaka Packager Version: v2.6.1-634af65-release

Issue and steps to reproduce the problem

Packager Command:

packager-linux-x64 in=../test.mp4,stream=audio,output=audio.mp4,drm_label=AUDIO in=../test.mp4,stream=video,output=video.mp4,drm_label=SD --protection_scheme cbcs --enable_raw_key_encryption --keys label=AUDIO:key_id=whatever_key_id:key=whatever_key,label=SD:key_id=whatever_key_id:key=whatever_key --hls_master_playlist_output hls_sample_aes.m3u8

Extra steps to reproduce the problem?

The issue applies to any encrypted HLS not using a DRM (so no "--protection_systems" specified) and where "--hls_key_uri" option is not specified (so that EXT-X-KEY URI is then set to an embedded data uri in the generated HLS playlist).

What is the expected result?

EXT-X-KEY URI should be set to a data uri containing the encryption key in plain text (base64 encoded) so that the HLS is playable in Safari with Shaka player or in the native player.

What happens instead?

The key id gets embedded base64 encoded as the data uri in EXT-X-KEY URI instead of the encryption key itself. In result the generated HLS is not playable anywhere because the encrypted fragments obviously cannot be decrypted with just the key id alone.

The problem appears to be here in the code:

key_id_string = "0x" + base::HexEncode(key_id.data(), key_id.size());

And I think this bug may be the reason also for other reported issues where users weren't able to get the generated HLS with KEYFORMAT="identity" to play anywhere, e.g. this one: #776

@cosmin cosmin added component: HLS The issue involves HLS output flag: good first issue This might be a relatively easy issue; good for new contributors flag: seeking PR We are actively seeking PRs for this; we do not currently expect the core team will resolve this labels Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: HLS The issue involves HLS output flag: good first issue This might be a relatively easy issue; good for new contributors flag: seeking PR We are actively seeking PRs for this; we do not currently expect the core team will resolve this
Projects
None yet
Development

No branches or pull requests

2 participants