PDA

View Full Version : Decrypt AES-128 encrypted video files from a m3u8 in PHP


tinware
11-10-2017, 06:08 AM
Hello,

I wanted to present you a very unusual program, from which created I have a big problem.


This is my HLS playlist (.m3u8)
#EXT-X-KEY:METHOD=AES-128,URI="01.key",IV=0x00000000000000000000015FA0E49B00
#EXTINF:9.480,
01.ts


According to this information, I create variables in PHP
<?php

$segment = file_get_contents("01.ts");
$key_method = "AES-128-CBC"; // ??
$key_value = file_get_contents("01.key");
$key_iv = "0x00000000000000000000015FA0E49B00"; // ?


And then I would like this file to decrypt, for example:
$decrypted = openssl_decrypt(
$segment,
$key_method,
$key_value,
0,
$key_iv

);


And display:
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="01_decrypt.ts"');
echo $decrypted;


The result of my program is warning:
openssl_decrypt(): IV passed is 34 bytes long which is longer than the 16 expected by selected cipher, truncating in ...


Download source files (.m3u8, .key and .ts):
http://www26.zippyshare.com/v/VyurKv7c/file.html


I ask you for help