使用 OpenSSL 解密 .ts 文件

Using OpenSSL to decrypt a .ts file

一切都在同一个目录中。

M3u8 文件:

#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‚

我知道内容是合法的,因为如果我右键单击 .m3u8 和 select "Play with VLC media player" 它就可以了。我需要解密 ts 文件,以便我可以使用 ffprobe 并检查内容。

这是我试过的 OpenSSL 命令

openssl aes-128-cbc -d -kfile MyKeyFile.key -iv 0 -nosalt -in aes_ts_files/filesequence0000000.ts -out aes_ts_files/filesequence0000000_out.ts

错误信息: 坏解密 18676:error:06065064:digital 信封 routines:EVP_DecryptFinal_ex:bad decrypt:c rypto\evp\evp_enc.c:529:

-kfile 用于从文件第一行中存储的密码派生密钥。

已经拥有实际密钥,因此您需要使用-K key传递它,其中key是十六进制的密钥(xxd -p MyKeyFile.key)。

IV也是一个十六进制字符串,如果没有指定,它等于媒体序列。