diff options
author | albertb@chromium.org <albertb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-06 17:26:49 +0000 |
---|---|---|
committer | albertb@chromium.org <albertb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-06 17:26:49 +0000 |
commit | 7a8ecd52ab89ce3a10751130222ff9594cf6c590 (patch) | |
tree | 3c1d966e1ffda9addbd209d09bfade94f96ef84c /chrome | |
parent | 0a54cf143f3ccd448b70f20ed3322cd1b506143b (diff) | |
download | chromium_src-7a8ecd52ab89ce3a10751130222ff9594cf6c590.zip chromium_src-7a8ecd52ab89ce3a10751130222ff9594cf6c590.tar.gz chromium_src-7a8ecd52ab89ce3a10751130222ff9594cf6c590.tar.bz2 |
Export and imports raw keys in the Cryptographer.
BUG=48701
TEST=CryptographerTest.*
Review URL: http://codereview.chromium.org/3043046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55247 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/sync/protocol/nigori_specifics.proto | 6 | ||||
-rw-r--r-- | chrome/browser/sync/util/cryptographer.cc | 12 |
2 files changed, 9 insertions, 9 deletions
diff --git a/chrome/browser/sync/protocol/nigori_specifics.proto b/chrome/browser/sync/protocol/nigori_specifics.proto index ed896b6..205291f 100644 --- a/chrome/browser/sync/protocol/nigori_specifics.proto +++ b/chrome/browser/sync/protocol/nigori_specifics.proto @@ -18,9 +18,9 @@ import "sync.proto"; message NigoriKey { optional string name = 1; - optional string hostname = 2; - optional string username = 3; - optional string password = 4; + optional bytes user_key = 2; + optional bytes encryption_key = 3; + optional bytes mac_key = 4; } message NigoriKeyBag { diff --git a/chrome/browser/sync/util/cryptographer.cc b/chrome/browser/sync/util/cryptographer.cc index 7a5e173..fd7d900 100644 --- a/chrome/browser/sync/util/cryptographer.cc +++ b/chrome/browser/sync/util/cryptographer.cc @@ -70,9 +70,9 @@ bool Cryptographer::GetKeys(sync_pb::EncryptedData* encrypted) const { const Nigori& nigori = *it->second; sync_pb::NigoriKey* key = bag.add_key(); key->set_name(it->first); - key->set_hostname(nigori.hostname()); - key->set_username(nigori.username()); - key->set_password(nigori.password()); + nigori.ExportKeys(key->mutable_user_key(), + key->mutable_encryption_key(), + key->mutable_mac_key()); } // Encrypt the bag with the default Nigori. @@ -147,9 +147,9 @@ void Cryptographer::InstallKeys(const std::string& default_key_name, // Only use this key if we don't already know about it. if (nigoris_.end() == nigoris_.find(key.name())) { scoped_ptr<Nigori> new_nigori(new Nigori); - if (!new_nigori->InitByDerivation(key.hostname(), - key.username(), - key.password())) { + if (!new_nigori->InitByImport(key.user_key(), + key.encryption_key(), + key.mac_key())) { NOTREACHED(); continue; } |