[The following thread is posted under the same tags as a similar thread to which I will make a reference: https://stackoverflow.com/questions/65939796/java-how-do-i-decrypt-chrome-cookies ]
Hello everyone, as you have read in the title, I am getting a AEADBadTagException whilst attempting to decrypt my credentials, I am aware that credentials prior to the chrome v80 (chromium equivalent) can no longer simply be "decrypted" through the cryptunprodecteddata method. I have done some reading into the new ways chrome deals with and figured out they were encrypted with aes-256. And i figured out how to decrypt that too. However, this only works for recently saved credentials, all my old credentials when attempting to decrypt them through the old process (despite having the v10 prefix) throw the AEADBadTagException
Java - How do I decrypt Chrome cookies? This is where i sourced the base for my code ( I am aware it is pretty much a copy paste but i do credit the author within my code )
HashMap<String, String> dataMap = new HashMap<>();
if (new String(encryptedCred).contains("v10")) {
try {
byte[] nonce = Arrays.copyOfRange(encryptedCred, 3, 3 + 12);
byte[] ciphertextTag = Arrays.copyOfRange(encryptedCred, 3 + 12, encryptedCred.length);
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
GCMParameterSpec gcmParameterSpec = new GCMParameterSpec(128, nonce);
assert masterKey != null;
SecretKeySpec keySpec = new SecretKeySpec(masterKey, "AES");
cipher.init(Cipher.DECRYPT_MODE, keySpec, gcmParameterSpec);
byte[] decryptedCred = cipher.doFinal(ciphertextTag);
dataMap.put("origin_url", resultSet.getString("origin_url").replace("\\/", "/"));
dataMap.put("username_value", resultSet.getString("username_value").replace("\\/", "/"));
dataMap.put("password_value", new String(decryptedCred).replace("\\/", "/"));
} catch (AEADBadTagException e){
e.printStackTrace();
bad_counter++;
}
else {
Crypt32Util.blablabla()
}
What else have I tried: AES/GCM/PKCS5Padding AES/GCM/NoPadding
Attempt to decrypt the result with cryptutilunprtectedtata Attempt to decrypt with cryptutilunprtectedtata and then aes-256
So now I am starting to wonder whether or not it is possible to decrypt previously stored credentials that are still past chrome v80