Commit 3feb6cf4 authored by Maksim Moskvitin's avatar Maksim Moskvitin Committed by Commit Bot

[Sync] Add test for implicit passphrase Nigori

In case of implicit passphrase Nigori the only required field in
NigoriSpecifics is encryption_keybag. New test covers this case and
checks that passwords could be decrypted once passphrase is provided.

Bug: 922900
Change-Id: I36a2e837d4150fd16b1edcf94d8adf24c34f6b90
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1863096
Commit-Queue: Maksim Moskvitin <mmoskvitin@google.com>
Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707785}
parent ad73f455
...@@ -145,6 +145,33 @@ IN_PROC_BROWSER_TEST_P(SingleClientNigoriSyncTestWithUssTests, ...@@ -145,6 +145,33 @@ IN_PROC_BROWSER_TEST_P(SingleClientNigoriSyncTestWithUssTests,
EXPECT_TRUE(specifics.has_keystore_migration_time()); EXPECT_TRUE(specifics.has_keystore_migration_time());
} }
// Tests that client can decrypt passwords, encrypted with implicit passphrase.
// Test first injects implicit passphrase Nigori and encrypted password form to
// fake server and then checks that client successfully received and decrypted
// this password form.
IN_PROC_BROWSER_TEST_P(SingleClientNigoriSyncTestWithUssTests,
ShouldDecryptWithImplicitPassphraseNigori) {
const KeyParams kKeyParams = {syncer::KeyDerivationParams::CreateForPbkdf2(),
"passphrase"};
sync_pb::NigoriSpecifics specifics;
std::unique_ptr<syncer::CryptographerImpl> cryptographer =
syncer::CryptographerImpl::FromSingleKeyForTesting(
kKeyParams.password, kKeyParams.derivation_params);
ASSERT_TRUE(cryptographer->Encrypt(cryptographer->ToProto().key_bag(),
specifics.mutable_encryption_keybag()));
SetNigoriInFakeServer(GetFakeServer(), specifics);
const autofill::PasswordForm password_form =
passwords_helper::CreateTestPasswordForm(0);
passwords_helper::InjectEncryptedServerPassword(
password_form, kKeyParams.password, kKeyParams.derivation_params,
GetFakeServer());
SetDecryptionPassphraseForClient(/*index=*/0, kKeyParams.password);
ASSERT_TRUE(SetupSync());
EXPECT_TRUE(WaitForPasswordForms({password_form}));
}
// Tests that client can decrypt passwords, encrypted with keystore key in case // Tests that client can decrypt passwords, encrypted with keystore key in case
// Nigori node contains only this key. We first inject keystore Nigori and // Nigori node contains only this key. We first inject keystore Nigori and
// encrypted password form to fake server and then check that client // encrypted password form to fake server and then check that client
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment