diff options
author | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-13 21:52:28 +0000 |
---|---|---|
committer | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-13 21:52:28 +0000 |
commit | 19fb909bb05f2574c3fc0f16455c68b6143b2e75 (patch) | |
tree | 4c5eb62def367c4c58422b3f3524cc56e8bfba57 /sync/test/fake_sync_encryption_handler.cc | |
parent | 8c55c673a845f9e3d8556c9e755d3247c051800a (diff) | |
download | chromium_src-19fb909bb05f2574c3fc0f16455c68b6143b2e75.zip chromium_src-19fb909bb05f2574c3fc0f16455c68b6143b2e75.tar.gz chromium_src-19fb909bb05f2574c3fc0f16455c68b6143b2e75.tar.bz2 |
[Sync] Implement keystore migration support.
We'll now trigger migration if the keystore key is available, the cryptographer
is ready, and the nigori node isn't already properly migrated. Note that this
means we won't trigger migration without at least the implicit gaia password
already available to the cryptographer, in order to support backwards
compatibility with older clients. Eventually that will change.
In addition, once a nigori node has been migrated, any client that supports
keystore encryption will follow the new encryption constraints, whether
or not the --sync-keystore-encryption flag is passed. This means that if
the user sets a custom passphrase, encrypt everything will also be enabled
(and vice versa).
Migration-aware conflict resolution is not implemented yet.
BUG=129665
Review URL: https://chromiumcodereview.appspot.com/10916036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156646 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/test/fake_sync_encryption_handler.cc')
-rw-r--r-- | sync/test/fake_sync_encryption_handler.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/sync/test/fake_sync_encryption_handler.cc b/sync/test/fake_sync_encryption_handler.cc index 1dbdf8b..b672ee3 100644 --- a/sync/test/fake_sync_encryption_handler.cc +++ b/sync/test/fake_sync_encryption_handler.cc @@ -12,7 +12,7 @@ namespace syncer { FakeSyncEncryptionHandler::FakeSyncEncryptionHandler() : encrypted_types_(SensitiveTypes()), encrypt_everything_(false), - passphrase_state_(IMPLICIT_PASSPHRASE), + passphrase_type_(IMPLICIT_PASSPHRASE), cryptographer_(&encryptor_) { } FakeSyncEncryptionHandler::~FakeSyncEncryptionHandler() {} @@ -26,13 +26,14 @@ void FakeSyncEncryptionHandler::ApplyNigoriUpdate( syncable::BaseTransaction* const trans) { if (nigori.encrypt_everything()) EnableEncryptEverything(); - if (nigori.using_explicit_passphrase()) - passphrase_state_ = CUSTOM_PASSPHRASE; + if (nigori.keybag_is_frozen()) + passphrase_type_ = CUSTOM_PASSPHRASE; - if (cryptographer_.CanDecrypt(nigori.encrypted())) - cryptographer_.InstallKeys(nigori.encrypted()); - else if (nigori.has_encrypted()) - cryptographer_.SetPendingKeys(nigori.encrypted()); + // TODO(zea): consider adding fake support for migration. + if (cryptographer_.CanDecrypt(nigori.encryption_keybag())) + cryptographer_.InstallKeys(nigori.encryption_keybag()); + else if (nigori.has_encryption_keybag()) + cryptographer_.SetPendingKeys(nigori.encryption_keybag()); if (cryptographer_.has_pending_keys()) { DVLOG(1) << "OnPassPhraseRequired Sent"; @@ -93,7 +94,7 @@ void FakeSyncEncryptionHandler::SetEncryptionPassphrase( const std::string& passphrase, bool is_explicit) { if (is_explicit) - passphrase_state_ = CUSTOM_PASSPHRASE; + passphrase_type_ = CUSTOM_PASSPHRASE; } void FakeSyncEncryptionHandler::SetDecryptionPassphrase( @@ -115,8 +116,8 @@ bool FakeSyncEncryptionHandler::EncryptEverythingEnabled() const { return encrypt_everything_; } -PassphraseState FakeSyncEncryptionHandler::GetPassphraseState() const { - return passphrase_state_; +PassphraseType FakeSyncEncryptionHandler::GetPassphraseType() const { + return passphrase_type_; } } // namespace syncer |