Decrypt Chrome Linux BLOB encrypted cookies in Python

前端 未结 3 721
情深已故
情深已故 2020-12-03 08:07

I have Chrome 33+ in Ubuntu and I see that the cookies are encrypted in a BLOB structure:

CREATE TABLE cookies (creation_utc INTEGER NOT NULL UNIQUE PRIMARY KE

3条回答
  •  萌比男神i
    2020-12-03 09:05

    The comments are a bit confusing so just to clarify, this is the chromium source in os_crypt_win.cc so you can see it's just putting the string into a blob and running CryptUnprotectData()

    bool OSCrypt::DecryptString(const std::string& ciphertext,
                                std::string* plaintext) {
      DATA_BLOB input;
      input.pbData = const_cast(
          reinterpret_cast(ciphertext.data()));
      input.cbData = static_cast(ciphertext.length());
    
      DATA_BLOB output;
      BOOL result = CryptUnprotectData(&input, NULL, NULL, NULL, NULL,
                                       0, &output);
      if (!result)
        return false;
    
      plaintext->assign(reinterpret_cast(output.pbData), output.cbData);
      LocalFree(output.pbData);
      return true;
    }
    

提交回复
热议问题