Audio/video stream recording forums (http://stream-recorder.com/forum/index.php)
-   Video stream recording (http://stream-recorder.com/forum/forumdisplay.php?f=4)
-   -  

Decrypt AES-128 encrypted video files from a m3u8 in PHP

(http://stream-recorder.com/forum/showthread.php?t=23708)

tinware 11-10-2017 06:08 AM

Decrypt AES-128 encrypted video files from a m3u8 in PHP


 
Hello,

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


This is my HLS playlist (.m3u8)
Code:

#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
Code:

<?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:
Code:

$decrypted = openssl_decrypt(
    $segment,
    $key_method,
    $key_value,
    0,
    $key_iv
   
);


And display:
Code:

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


The result of my program is warning:
Quote:

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


All times are GMT -6. The time now is 10:01 AM.