问题
Everything is in the same directory.
M3u8 File:
#EXTM3U
#EXT-X-ALLOW-CACHE:NO
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-KEY:METHOD=AES-128,URI=MyKeyFile.key
#EXTINF:10,
aes_ts_files/filesequence0000000.ts
#EXTINF:10,
aes_ts_files/filesequence0000001.ts
#EXTINF:10,
aes_ts_files/filesequence0000002.ts
#EXTINF:10,
aes_ts_files/filesequence0000003.ts
#EXTINF:10,
aes_ts_files/filesequence0000004.ts
#EXTINF:10,
aes_ts_files/filesequence0000005.ts
#EXTINF:10,
aes_ts_files/filesequence0000006.ts
#EXTINF:10,
aes_ts_files/filesequence0000007.ts
#EXTINF:10,
aes_ts_files/filesequence0000008.ts
#EXTINF:10,
aes_ts_files/filesequence0000009.ts
#EXTINF:10,
aes_ts_files/filesequence0000010.ts
#EXTINF:10,
aes_ts_files/filesequence0000011.ts
#EXTINF:10,
aes_ts_files/filesequence0000012.ts
#EXTINF:10,
aes_ts_files/filesequence0000013.ts
#EXTINF:10,
aes_ts_files/filesequence0000014.ts
#EXTINF:10,
aes_ts_files/filesequence0000015.ts
#EXTINF:10,
aes_ts_files/filesequence0000016.ts
#EXTINF:10,
aes_ts_files/filesequence0000017.ts
#EXTINF:10,
aes_ts_files/filesequence0000018.ts
#EXTINF:10,
aes_ts_files/filesequence0000019.ts
#EXTINF:10,
aes_ts_files/filesequence0000020.ts
#EXTINF:10,
aes_ts_files/filesequence0000021.ts
#EXTINF:10,
aes_ts_files/filesequence0000022.ts
#EXTINF:3,
aes_ts_files/filesequence0000023.ts
#EXT-X-ENDLIST
MyKeyFile.Key
tßâ0Äb‘˜p.ô[{m‚
I know the content is legit because if I right click on the .m3u8 and select "Play with VLC media player" it works. I need to decrypt the ts files so I can use ffprobe and inspect the content.
Here is the OpenSSL command I've tried:
openssl aes-128-cbc -d -kfile MyKeyFile.key -iv 0 -nosalt -in aes_ts_files/filesequence0000000.ts -out aes_ts_files/filesequence0000000_out.ts
Error Message: bad decrypt 18676:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:c rypto\evp\evp_enc.c:529:
回答1:
-kfile
is used to derive the key from a password stored in the first line of the file.
You already have the actual key so you need to pass it using -K key
where key is the key in hex (xxd -p MyKeyFile.key
).
The IV is also a hex string and it's equal to the media sequence if not specified.
来源:https://stackoverflow.com/questions/40366617/using-openssl-to-decrypt-a-ts-file