chrome-cookies-secure
chrome-cookies-secure copied to clipboard
Need help understanding how to decrypt for Chromium
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?
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).