Skip to content

Commit

Permalink
fix(clearkey): Do not pad data before decryption
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rlaphoenix committed May 17, 2024
1 parent 03f3fec commit e57d755
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions devine/core/drm/clearkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
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

Expand Down Expand Up @@ -43,7 +43,7 @@ def decrypt(self, path: Path) -> None:

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)
Expand Down

0 comments on commit e57d755

Please sign in to comment.