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

Need help understanding how to decrypt for Chromium #48

Open
fc opened this issue Mar 7, 2023 · 2 comments
Open

Need help understanding how to decrypt for Chromium #48

fc opened this issue Mar 7, 2023 · 2 comments

Comments

@fc
Copy link

fc commented Mar 7, 2023

I looked through the Chromium source code and I think this is the relevant section:
https://github.com/chromium/chromium/blob/dc778ef2640dfd02ee7a896b92cd72e8f6d5cdf1/components/os_crypt/os_crypt_mac.mm#L35

// Salt for Symmetric key derivation.
constexpr char kSalt[] = "saltysalt";

// Key size required for 128 bit AES.
constexpr size_t kDerivedKeySizeInBits = 128;

// Constant for Symmetic key derivation.
constexpr size_t kEncryptionIterations = 1003;

I tried updating your module to use 1003 iterations when loading the Chromium sqlite db but it doesn't appear to be decrypting correctly.
Searching the chromium source for DeriveKeyFromPasswordUsingPbkdf2 seems to hint a little bit of how it works.

Possibly related source code is persistent cookie store code here or in here.

Besides changing setting the path to support Chromium and trying different iteration values, I also made this change:

		keytar.getPassword('Chromium Safe Storage', 'Chromium').then(function(chromePassword) {
			crypto.pbkdf2(chromePassword, SALT, 1003, KEYLENGTH, 'sha1', callback);
		});

It returns the values but they're all garbled since they weren't decrypted correctly.

What else might I be missing?

@rubengmurray
Copy link
Collaborator

What platform are you attempting to use Chromium on? There is a test in here that uses Chromium on Linux that passed the last time I ran it (last release).

@rubengmurray
Copy link
Collaborator

rubengmurray commented Oct 11, 2024

@fc will schedule to close this one unless you want to provide platform for further debugging?

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

No branches or pull requests

2 participants