'Use hls.js to view an encrypted stream using a binary as the key

I'm trying to find a secure way to view an encrypted stream using hls.js.

One way I thought of was to have the stream playlist without the EXT-X-KEY tag and append it on load and then feeding the resulting blob as a URL to the hls.js initialiser. But I got concerns from other dev that this way the blob is going to be cached and could be extracted along with the key.

Is there a way to securely provide the hls.js with the key as binary and avoid caching?



Solution 1:[1]

Encryption makes the HLS package unreadable if you don't have the key.

Digital Rights Management (DRM) is responsible for the secure key exchange and the licensing.

Your browser handles the secure key exchange inside the Content Decryption Module.

So what you need is a DRM system. It looks like hls.js only supports Widevine. This looks like a good summary Widevine DRM: https://www.vdocipher.com/blog/widevine-drm-hollywood-video/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Markus Schumann