View Single Post
  #1  
Old 11-10-2017, 06:08 AM
tinware tinware is offline
Junior Member
 
Join Date: Nov 2017
Posts: 2
tinware is on a distinguished road
Default

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

Last edited by tinware : 11-10-2017 at 05:42 PM.
Reply With Quote