[fragments] Pad fragments before decrypting (#1298)

Closes #197, #1297, #1007
Authored by: shirt-dev
pull/1332/head
shirt 3 years ago committed by GitHub
parent 920134b2e5
commit 373475f035
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -355,7 +355,8 @@ 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)
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…
Cancel
Save