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

Side by Side Diff: chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_operation.cc

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_oper ation.h" 5 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_oper ation.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 key_def.provider_data.push_back(cryptohome::KeyDefinition::ProviderData( 339 key_def.provider_data.push_back(cryptohome::KeyDefinition::ProviderData(
340 kEasyUnlockKeyMetaNamePsk, device->psk)); 340 kEasyUnlockKeyMetaNamePsk, device->psk));
341 key_def.provider_data.push_back(cryptohome::KeyDefinition::ProviderData( 341 key_def.provider_data.push_back(cryptohome::KeyDefinition::ProviderData(
342 kEasyUnlockKeyMetaNamePubKey, device->public_key)); 342 kEasyUnlockKeyMetaNamePubKey, device->public_key));
343 key_def.provider_data.push_back(cryptohome::KeyDefinition::ProviderData( 343 key_def.provider_data.push_back(cryptohome::KeyDefinition::ProviderData(
344 kEasyUnlockKeyMetaNameChallenge, device->challenge)); 344 kEasyUnlockKeyMetaNameChallenge, device->challenge));
345 key_def.provider_data.push_back(cryptohome::KeyDefinition::ProviderData( 345 key_def.provider_data.push_back(cryptohome::KeyDefinition::ProviderData(
346 kEasyUnlockKeyMetaNameWrappedSecret, device->wrapped_secret)); 346 kEasyUnlockKeyMetaNameWrappedSecret, device->wrapped_secret));
347 347
348 // Add cryptohome key. 348 // Add cryptohome key.
349 std::string canonicalized = 349 cryptohome::Identification id(user_context_.GetUserID());
350 gaia::CanonicalizeEmail(user_context_.GetUserID());
351 cryptohome::Identification id(canonicalized);
352 350
353 scoped_ptr<Key> auth_key(new Key(*user_context_.GetKey())); 351 scoped_ptr<Key> auth_key(new Key(*user_context_.GetKey()));
354 if (auth_key->GetKeyType() == Key::KEY_TYPE_PASSWORD_PLAIN) 352 if (auth_key->GetKeyType() == Key::KEY_TYPE_PASSWORD_PLAIN)
355 auth_key->Transform(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt); 353 auth_key->Transform(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt);
356 354
357 cryptohome::Authorization auth(auth_key->GetSecret(), auth_key->GetLabel()); 355 cryptohome::Authorization auth(auth_key->GetSecret(), auth_key->GetLabel());
358 cryptohome::HomedirMethods::GetInstance()->AddKeyEx( 356 cryptohome::HomedirMethods::GetInstance()->AddKeyEx(
359 id, 357 id,
360 auth, 358 auth,
361 key_def, 359 key_def,
(...skipping 23 matching lines...) Expand all
385 user_context_.GetKey()->GetLabel() == 383 user_context_.GetKey()->GetLabel() ==
386 EasyUnlockKeyManager::GetKeyLabel(key_creation_index_)) { 384 EasyUnlockKeyManager::GetKeyLabel(key_creation_index_)) {
387 user_context_.SetKey(user_key); 385 user_context_.SetKey(user_key);
388 } 386 }
389 387
390 ++key_creation_index_; 388 ++key_creation_index_;
391 CreateKeyForDeviceAtIndex(key_creation_index_); 389 CreateKeyForDeviceAtIndex(key_creation_index_);
392 } 390 }
393 391
394 } // namespace chromeos 392 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698