title: Using openssl encryption for Apple's HTTP Live Streaming
body: <p>Has anyone had any luck getting encrypted streaming to work with Apple's HTTP Live Streaming using openssl? It seems I'm almost there but my video doesn't play but I don't get any errors in Safari either (like &quot;Video is unplayable&quot; or &quot;You don't have permission to play this video&quot; when I got the key wrong).</p>
  <pre><code>#bash script:
  keyFile=&quot;key.txt&quot;
  openssl rand 16 &gt; $keyFile
  hexKey=$(cat key.txt | hexdump -e '&quot;%x&quot;')
  hexIV='0'
  openssl aes-128-cbc -e -in $fileName -out $encryptedFileName -p -nosalt -iv ${hexIV}  -K ${hexKey}
  
  
  #my playlist file:
  #EXTM3U
  #EXT-X-TARGETDURATION:000020
  #EXT-X-MEDIA-SEQUENCE:0
  #EXT-X-KEY:METHOD=AES-128,URI=&quot;key.txt&quot;
  #EXTINF:20, no desc
  test.ts.enc
  #EXT-X-ENDLIST
  </code></pre>
  <p>I was using these docs as a guide:</p>
  <p><a href="https://datatracker.ietf.org/doc/html/draft-pantos-http-live-streaming" rel="nofollow noreferrer">https://datatracker.ietf.org/doc/html/draft-pantos-http-live-streaming</a></p>