1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-09-03 16:45:17 +00:00

[aes] Add unpad_pkcs7

This commit is contained in:
pukkandan
2022-01-31 20:19:33 +05:30
parent c533c89ce1
commit 1d3586d0d5
8 changed files with 45 additions and 53 deletions

View File

@ -14,7 +14,7 @@ except ImportError:
from .common import FileDownloader
from .http import HttpFD
from ..aes import aes_cbc_decrypt_bytes
from ..aes import aes_cbc_decrypt_bytes, unpad_pkcs7
from ..compat import (
compat_os_name,
compat_urllib_error,
@ -366,8 +366,7 @@ class FragmentFD(FileDownloader):
# not what it decrypts to.
if self.params.get('test', False):
return frag_content
decrypted_data = aes_cbc_decrypt_bytes(frag_content, decrypt_info['KEY'], iv)
return decrypted_data[:-decrypted_data[-1]]
return unpad_pkcs7(aes_cbc_decrypt_bytes(frag_content, decrypt_info['KEY'], iv))
return decrypt_fragment