| OLD | NEW |
| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 key_def.provider_data.push_back(cryptohome::KeyDefinition::ProviderData( | 348 key_def.provider_data.push_back(cryptohome::KeyDefinition::ProviderData( |
| 349 kEasyUnlockKeyMetaNamePsk, device->psk)); | 349 kEasyUnlockKeyMetaNamePsk, device->psk)); |
| 350 key_def.provider_data.push_back(cryptohome::KeyDefinition::ProviderData( | 350 key_def.provider_data.push_back(cryptohome::KeyDefinition::ProviderData( |
| 351 kEasyUnlockKeyMetaNamePubKey, device->public_key)); | 351 kEasyUnlockKeyMetaNamePubKey, device->public_key)); |
| 352 key_def.provider_data.push_back(cryptohome::KeyDefinition::ProviderData( | 352 key_def.provider_data.push_back(cryptohome::KeyDefinition::ProviderData( |
| 353 kEasyUnlockKeyMetaNameChallenge, device->challenge)); | 353 kEasyUnlockKeyMetaNameChallenge, device->challenge)); |
| 354 key_def.provider_data.push_back(cryptohome::KeyDefinition::ProviderData( | 354 key_def.provider_data.push_back(cryptohome::KeyDefinition::ProviderData( |
| 355 kEasyUnlockKeyMetaNameWrappedSecret, device->wrapped_secret)); | 355 kEasyUnlockKeyMetaNameWrappedSecret, device->wrapped_secret)); |
| 356 | 356 |
| 357 // Add cryptohome key. | 357 // Add cryptohome key. |
| 358 const std::string canonicalized = | 358 const cryptohome::Identification id(user_context_.GetAccountId()); |
| 359 gaia::CanonicalizeEmail(user_context_.GetAccountId().GetUserEmail()); | |
| 360 cryptohome::Identification id(canonicalized); | |
| 361 | 359 |
| 362 scoped_ptr<Key> auth_key(new Key(*user_context_.GetKey())); | 360 scoped_ptr<Key> auth_key(new Key(*user_context_.GetKey())); |
| 363 if (auth_key->GetKeyType() == Key::KEY_TYPE_PASSWORD_PLAIN) | 361 if (auth_key->GetKeyType() == Key::KEY_TYPE_PASSWORD_PLAIN) |
| 364 auth_key->Transform(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt); | 362 auth_key->Transform(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt); |
| 365 | 363 |
| 366 cryptohome::Authorization auth(auth_key->GetSecret(), auth_key->GetLabel()); | 364 cryptohome::Authorization auth(auth_key->GetSecret(), auth_key->GetLabel()); |
| 367 cryptohome::HomedirMethods::GetInstance()->AddKeyEx( | 365 cryptohome::HomedirMethods::GetInstance()->AddKeyEx( |
| 368 id, | 366 id, |
| 369 auth, | 367 auth, |
| 370 key_def, | 368 key_def, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 394 user_context_.GetKey()->GetLabel() == | 392 user_context_.GetKey()->GetLabel() == |
| 395 EasyUnlockKeyManager::GetKeyLabel(key_creation_index_)) { | 393 EasyUnlockKeyManager::GetKeyLabel(key_creation_index_)) { |
| 396 user_context_.SetKey(user_key); | 394 user_context_.SetKey(user_key); |
| 397 } | 395 } |
| 398 | 396 |
| 399 ++key_creation_index_; | 397 ++key_creation_index_; |
| 400 CreateKeyForDeviceAtIndex(key_creation_index_); | 398 CreateKeyForDeviceAtIndex(key_creation_index_); |
| 401 } | 399 } |
| 402 | 400 |
| 403 } // namespace chromeos | 401 } // namespace chromeos |
| OLD | NEW |