From e57d75583705cfc6be5a201e9abc7f2563cb5f73 Mon Sep 17 00:00:00 2001 From: rlaphoenix <17136956+rlaphoenix@users.noreply.github.com> Date: Fri, 17 May 2024 00:58:20 +0100 Subject: [PATCH] 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. --- devine/core/drm/clearkey.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devine/core/drm/clearkey.py b/devine/core/drm/clearkey.py index dfec042..4869fe7 100644 --- a/devine/core/drm/clearkey.py +++ b/devine/core/drm/clearkey.py @@ -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)