fix: support Linux v11 cipher prefix for Chromium decryption (#571)

This commit is contained in:
Roger
2026-04-13 22:12:40 +08:00
committed by GitHub
parent 370c5882c4
commit eb58ebbbf4
8 changed files with 105 additions and 7 deletions
+2 -1
View File
@@ -16,7 +16,8 @@ func decryptValue(masterKey, ciphertext []byte) ([]byte, error) {
version := crypto.DetectVersion(ciphertext)
switch version {
case crypto.CipherV10:
case crypto.CipherV10, crypto.CipherV11:
// v11 is Linux-only and shares v10's AES-CBC path; only the key source differs.
return crypto.DecryptChromium(masterKey, ciphertext)
case crypto.CipherV20:
// TODO: implement App-Bound Encryption (Chrome 127+)
+12
View File
@@ -52,6 +52,18 @@ func TestDecryptValue_V10(t *testing.T) {
}
}
func TestDecryptValue_V11(t *testing.T) {
plaintext := []byte("test_secret_value")
testCBCIV := bytes.Repeat([]byte{0x20}, 16)
cbcEncrypted, err := crypto.AESCBCEncrypt(testAESKey, testCBCIV, plaintext)
require.NoError(t, err)
v11Ciphertext := append([]byte("v11"), cbcEncrypted...)
got, err := decryptValue(testAESKey, v11Ciphertext)
require.NoError(t, err)
assert.Equal(t, plaintext, got)
}
func TestDecryptValue_V20(t *testing.T) {
// v20 App-Bound Encryption is not yet implemented.
// TODO: add successful decryption cases when implemented.