mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 10:31:29 +00:00
[fragments] Pad fragments before decrypting (#1298)
Closes #197, #1297, #1007 Authored by: shirt-dev
This commit is contained in:
parent
920134b2e5
commit
373475f035
|
@ -355,7 +355,8 @@ def decrypt_fragment(fragment, frag_content):
|
|||
# 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)
|
||||
padding_len = 16 - (len(frag_content) % 16)
|
||||
decrypted_data = aes_cbc_decrypt_bytes(frag_content + bytes([padding_len] * padding_len), decrypt_info['KEY'], iv)
|
||||
return decrypted_data[:-decrypted_data[-1]]
|
||||
|
||||
return decrypt_fragment
|
||||
|
|
Loading…
Reference in a new issue