fix(clearkey): Do not pad data before decryption

This is seemingly unnecessary and simply incorrect at least for two sources (VGTV, and TRUTV).

Without this change it is not possible to correctly merge all segments without at least some problem in the resulting file.
This commit is contained in:
rlaphoenix 2024-05-17 00:58:20 +01:00
parent 03f3fec5cc
commit e57d755837
1 changed files with 2 additions and 2 deletions

View File

@ -7,7 +7,7 @@ from typing import Optional, Union
from urllib.parse import urljoin
from Cryptodome.Cipher import AES
from Cryptodome.Util.Padding import pad, unpad
from Cryptodome.Util.Padding import unpad
from m3u8.model import Key
from requests import Session
@ -43,7 +43,7 @@ class ClearKey:
decrypted = AES. \
new(self.key, AES.MODE_CBC, self.iv). \
decrypt(pad(path.read_bytes(), AES.block_size))
decrypt(path.read_bytes())
try:
decrypted = unpad(decrypted, AES.block_size)