OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/sync/core_impl/sync_encryption_handler_impl.h" | 5 #include "components/sync/core_impl/sync_encryption_handler_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
188 if (!internal_list_value->GetString(number_of_keystore_keys - 1, | 188 if (!internal_list_value->GetString(number_of_keystore_keys - 1, |
189 current_keystore_key)) { | 189 current_keystore_key)) { |
190 return false; | 190 return false; |
191 } | 191 } |
192 old_keystore_keys->resize(number_of_keystore_keys - 1); | 192 old_keystore_keys->resize(number_of_keystore_keys - 1); |
193 for (int i = 0; i < number_of_keystore_keys - 1; ++i) | 193 for (int i = 0; i < number_of_keystore_keys - 1; ++i) |
194 internal_list_value->GetString(i, &(*old_keystore_keys)[i]); | 194 internal_list_value->GetString(i, &(*old_keystore_keys)[i]); |
195 return true; | 195 return true; |
196 } | 196 } |
197 | 197 |
198 // If the user starts using custom passphrase, then unencrypted metadata fields | |
199 // for the password entity should be cleared. | |
200 sync_pb::PasswordSpecificsMetadata | |
201 ProcessPasswordSpecificMetadataForExplicitPassphareUsers( | |
202 const sync_pb::PasswordSpecificsMetadata& password_metadata) { | |
203 return sync_pb::PasswordSpecificsMetadata(); | |
204 } | |
205 | |
198 } // namespace | 206 } // namespace |
199 | 207 |
200 SyncEncryptionHandlerImpl::Vault::Vault(Encryptor* encryptor, | 208 SyncEncryptionHandlerImpl::Vault::Vault(Encryptor* encryptor, |
201 ModelTypeSet encrypted_types) | 209 ModelTypeSet encrypted_types) |
202 : cryptographer(encryptor), encrypted_types(encrypted_types) {} | 210 : cryptographer(encryptor), encrypted_types(encrypted_types) {} |
203 | 211 |
204 SyncEncryptionHandlerImpl::Vault::~Vault() {} | 212 SyncEncryptionHandlerImpl::Vault::~Vault() {} |
205 | 213 |
206 SyncEncryptionHandlerImpl::SyncEncryptionHandlerImpl( | 214 SyncEncryptionHandlerImpl::SyncEncryptionHandlerImpl( |
207 UserShare* user_share, | 215 UserShare* user_share, |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
835 // Passwords are encrypted with their own legacy scheme. Passwords are always | 843 // Passwords are encrypted with their own legacy scheme. Passwords are always |
836 // encrypted so we don't need to check GetEncryptedTypes() here. | 844 // encrypted so we don't need to check GetEncryptedTypes() here. |
837 ReadNode passwords_root(trans); | 845 ReadNode passwords_root(trans); |
838 if (passwords_root.InitTypeRoot(PASSWORDS) == BaseNode::INIT_OK) { | 846 if (passwords_root.InitTypeRoot(PASSWORDS) == BaseNode::INIT_OK) { |
839 int64_t child_id = passwords_root.GetFirstChildId(); | 847 int64_t child_id = passwords_root.GetFirstChildId(); |
840 while (child_id != kInvalidId) { | 848 while (child_id != kInvalidId) { |
841 WriteNode child(trans); | 849 WriteNode child(trans); |
842 if (child.InitByIdLookup(child_id) != BaseNode::INIT_OK) | 850 if (child.InitByIdLookup(child_id) != BaseNode::INIT_OK) |
843 break; // Possible if we failed to decrypt the data for some reason. | 851 break; // Possible if we failed to decrypt the data for some reason. |
844 child.SetPasswordSpecifics(child.GetPasswordSpecifics()); | 852 child.SetPasswordSpecifics(child.GetPasswordSpecifics()); |
853 if (IsExplicitPassphrase(passphrase_type_)) { | |
854 child.SetPasswordSpecificsMetadata( | |
Nicolas Zea
2016/08/20 00:23:43
It occurs to me that I don't think you need this.
melandory
2016/08/22 22:08:41
Disclaimer. Text below is written with an assumpti
| |
855 ProcessPasswordSpecificMetadataForExplicitPassphareUsers( | |
856 child.GetPasswordSpecificsMetadata())); | |
857 } | |
845 child_id = child.GetSuccessorId(); | 858 child_id = child.GetSuccessorId(); |
846 } | 859 } |
847 } | 860 } |
848 | 861 |
849 DVLOG(1) << "Re-encrypt everything complete."; | 862 DVLOG(1) << "Re-encrypt everything complete."; |
850 | 863 |
851 // NOTE: We notify from within a transaction. | 864 // NOTE: We notify from within a transaction. |
852 FOR_EACH_OBSERVER(SyncEncryptionHandler::Observer, observers_, | 865 FOR_EACH_OBSERVER(SyncEncryptionHandler::Observer, observers_, |
853 OnEncryptionComplete()); | 866 OnEncryptionComplete()); |
854 } | 867 } |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1639 | 1652 |
1640 base::Time SyncEncryptionHandlerImpl::GetExplicitPassphraseTime() const { | 1653 base::Time SyncEncryptionHandlerImpl::GetExplicitPassphraseTime() const { |
1641 if (passphrase_type_ == FROZEN_IMPLICIT_PASSPHRASE) | 1654 if (passphrase_type_ == FROZEN_IMPLICIT_PASSPHRASE) |
1642 return migration_time(); | 1655 return migration_time(); |
1643 else if (passphrase_type_ == CUSTOM_PASSPHRASE) | 1656 else if (passphrase_type_ == CUSTOM_PASSPHRASE) |
1644 return custom_passphrase_time(); | 1657 return custom_passphrase_time(); |
1645 return base::Time(); | 1658 return base::Time(); |
1646 } | 1659 } |
1647 | 1660 |
1648 } // namespace syncer | 1661 } // namespace syncer |
OLD | NEW |