mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-02 14:37:21 +00:00
[cookies] fix chrome aes_cbc plaintext unicode decoding
This commit is contained in:
parent
a6783a3b99
commit
efa7ec323a
|
@ -1013,8 +1013,9 @@ def pbkdf2_sha1(password, salt, iterations, key_length):
|
|||
def _decrypt_aes_cbc_multi(ciphertext, keys, logger, initialization_vector=b' ' * 16):
|
||||
for key in keys:
|
||||
plaintext = unpad_pkcs7(aes_cbc_decrypt_bytes(ciphertext, key, initialization_vector))
|
||||
for cookie in (plaintext, plaintext[32:]):
|
||||
try:
|
||||
return plaintext.decode()
|
||||
return cookie.decode()
|
||||
except UnicodeDecodeError:
|
||||
pass
|
||||
logger.warning('failed to decrypt cookie (AES-CBC) because UTF-8 decoding failed. Possibly the key is wrong?', only_once=True)
|
||||
|
|
Loading…
Reference in a new issue