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 "sync/internal_api/sync_encryption_handler_impl.h" | 5 #include "sync/internal_api/sync_encryption_handler_impl.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1512 } | 1512 } |
1513 | 1513 |
1514 bool SyncEncryptionHandlerImpl::GetKeystoreDecryptor( | 1514 bool SyncEncryptionHandlerImpl::GetKeystoreDecryptor( |
1515 const Cryptographer& cryptographer, | 1515 const Cryptographer& cryptographer, |
1516 const std::string& keystore_key, | 1516 const std::string& keystore_key, |
1517 sync_pb::EncryptedData* encrypted_blob) { | 1517 sync_pb::EncryptedData* encrypted_blob) { |
1518 DCHECK(thread_checker_.CalledOnValidThread()); | 1518 DCHECK(thread_checker_.CalledOnValidThread()); |
1519 DCHECK(!keystore_key.empty()); | 1519 DCHECK(!keystore_key.empty()); |
1520 DCHECK(cryptographer.is_ready()); | 1520 DCHECK(cryptographer.is_ready()); |
1521 std::string serialized_nigori; | 1521 std::string serialized_nigori; |
1522 serialized_nigori = cryptographer.GetDefaultNigoriKey(); | 1522 serialized_nigori = cryptographer.GetDefaultNigoriKeyData(); |
1523 if (serialized_nigori.empty()) { | 1523 if (serialized_nigori.empty()) { |
1524 LOG(ERROR) << "Failed to get cryptographer bootstrap token."; | 1524 LOG(ERROR) << "Failed to get cryptographer bootstrap token."; |
1525 return false; | 1525 return false; |
1526 } | 1526 } |
1527 Cryptographer temp_cryptographer(cryptographer.encryptor()); | 1527 Cryptographer temp_cryptographer(cryptographer.encryptor()); |
1528 KeyParams key_params = {"localhost", "dummy", keystore_key}; | 1528 KeyParams key_params = {"localhost", "dummy", keystore_key}; |
1529 if (!temp_cryptographer.AddKey(key_params)) | 1529 if (!temp_cryptographer.AddKey(key_params)) |
1530 return false; | 1530 return false; |
1531 if (!temp_cryptographer.EncryptString(serialized_nigori, encrypted_blob)) | 1531 if (!temp_cryptographer.EncryptString(serialized_nigori, encrypted_blob)) |
1532 return false; | 1532 return false; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1638 | 1638 |
1639 base::Time SyncEncryptionHandlerImpl::GetExplicitPassphraseTime() const { | 1639 base::Time SyncEncryptionHandlerImpl::GetExplicitPassphraseTime() const { |
1640 if (passphrase_type_ == FROZEN_IMPLICIT_PASSPHRASE) | 1640 if (passphrase_type_ == FROZEN_IMPLICIT_PASSPHRASE) |
1641 return migration_time(); | 1641 return migration_time(); |
1642 else if (passphrase_type_ == CUSTOM_PASSPHRASE) | 1642 else if (passphrase_type_ == CUSTOM_PASSPHRASE) |
1643 return custom_passphrase_time(); | 1643 return custom_passphrase_time(); |
1644 return base::Time(); | 1644 return base::Time(); |
1645 } | 1645 } |
1646 | 1646 |
1647 } // namespace browser_sync | 1647 } // namespace browser_sync |
OLD | NEW |