Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to decrypt cookie (AES-CBC) because UTF-8 decoding failed. Possibly the key is wrong? #6567

Closed
pryans opened this issue Nov 30, 2024 · 2 comments

Comments

@pryans
Copy link

pryans commented Nov 30, 2024

Problem
After upgrading Brave browser, the --cookies-from-browser option can no longer decrypt cookies.

OS
linuxmint 5.15.0-126-generic #136-Ubuntu SMP Wed Nov 6 10:38:22 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Browser
Brave Browser 131.1.73.91

Command
gallery-dl --cookies-from-browser brave:/home/user/.config/BraveSoftware/Brave-Browser/Default

Error
[cookies][warning] failed to decrypt cookie (AES-CBC) because UTF-8 decoding failed. Possibly the key is wrong?
[cookies][info] Extracted 0 cookies from brave (369 could not be decrypted)
[cookies][debug] cookie version breakdown: {'v10': 0, 'v11': 369, 'other': 0, 'unencrypted': 0}

yt-dlp fix
yt-dlp/yt-dlp@4613096

Tested Workaround
I was able to make this change which fixed the issue.
In file
~/.local/lib/python3.10/site-packages/gallery_dl/cookies.py
change line 909 from
return plaintext.decode()
to
return plaintext[32:].decode()

@mikf
Copy link
Owner

mikf commented Nov 30, 2024

[cookies][warning] failed to decrypt cookie (AES-CBC) because UTF-8 decoding failed. Possibly the key is wrong?

You are using a very outdated version of gallery-dl.
This warning message was changed 1½ years ago in v1.25.5 (2e6cea9)

I was able to make this change which fixed the issue.

The same fix is present in the latest v1.28.0: d2db706

@pryans
Copy link
Author

pryans commented Nov 30, 2024

Yeah I messed up the pip upgrade command and didn't notice.

@pryans pryans closed this as completed Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants