Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: sync/internal_api/sync_encryption_handler_impl.cc

Issue 442053002: sync: Add non-blocking type encryption (retry) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « sync/internal_api/sync_context_proxy_impl.cc ('k') | sync/internal_api/test/null_sync_context_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698