mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-24 04:05:53 +01: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 New Issue
Block a user