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

Fix username code for ADE key retrieval #1946

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Leseratte10
Copy link

@Leseratte10 Leseratte10 commented Nov 28, 2021

There have been lots of reports of the error message "Failed to decrypt user key key (sic)" in the past. Looking at the source code, this error occurs when the Windows API call to CryptUnprotectData fails. This can happen if the entropy data is wrong.

ADE uses the Windows user name as part of that entropy data, and the script previously used the Windows API function GetUserNameW to retrieve the user's current user name.

However, this breaks when the user account has been renamed between ADE install and plugin usage. The key will be encrypted using the old name as entropy, but the python script will try to decrypt the key with the new current name, which will obviously fail.

Thankfully, ADE stores the user name (as it was at authorization time) in the registry - probably because ADE needs that info itself to access the key, so all that's needed to fix this is to read the user name from the registry instead of relying on Windows API.

This should be a proper fix (rather than the current workaround of "reinstall and re-authorize ADE") for #186, #252, #262, #278, #309, #348, #349, #371, #436, #471, #668, #708, #759, #815, #902, #1109, #1144, #1395 and #1938, all of which seem to be duplicates of eachother.

@mizuOda
Copy link

mizuOda commented Nov 28, 2021

@Leseratte10 - Thanks for this!
FYI in case this isn't yet on your radar, @noDRM has forked this repo and is actively developing the plugin. Maybe worth a look at what they're doing? https://github.com/noDRM/DeDRM_tools

@Leseratte10
Copy link
Author

Yeah, I've seen that repo but haven't looked at it too closely. If noDRM doesn't see (and merge) this PR on his own I'll post it over there, too, in a couple days. Or did you mean this in a way like "maybe the bug's already fixed in there"?

@mizuOda
Copy link

mizuOda commented Nov 29, 2021

You probably already got notified, but noDRM merged your PR and released v10.0.2 with your fix today. Thank you.

Apprentice Harper also passed the torch to noDRM today and will no longer be maintaining this repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants