Search code examples
httpstreamopensslliveencryption

Problems decrypting HTTP Live Stream


I have a single key encrypted HTTP Live Stream which decodes fine in Quicktime and iPhone. I'm trying to create a simple client application to do the decryption of the ts files. Right now I've used openssl to decrypt. I believe I have the correct arguments to openssl and I'm inserting the key and the IV properly. I can successfully decrypt the first .ts file in the stream but fail to decrypt after. I'm using the following script which I found in the archives here and I reversed to do decryption:

#!/bin/sh

hexKey=$(cat encryption.key | hexdump-e '16/1 "%02x"') 
hexIV='00000000000000000000000000000001' 
openssl aes-128-cbc -d -in ./multi_2.ts -out ./clear.ts -p-nosalt -iv ${hexIV}  -K ${hexKey}

where:

encryption.key is the key file I retrieved from the M3u8 stream file.
multi_2.ts is the second .ts file in the m3u8 stream file.

Any help would be appreciated.


Solution

  • The subsequent .ts files are probably fine, you just need to join them into one file in order to be playable:

    cat clear*.ts > joined.ts