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 <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 Loading... |
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 const std::string canonicalized = |
350 gaia::CanonicalizeEmail(user_context_.GetUserID()); | 350 gaia::CanonicalizeEmail(user_context_.GetAccountId().GetUserEmail()); |
351 cryptohome::Identification id(canonicalized); | 351 cryptohome::Identification id(canonicalized); |
352 | 352 |
353 scoped_ptr<Key> auth_key(new Key(*user_context_.GetKey())); | 353 scoped_ptr<Key> auth_key(new Key(*user_context_.GetKey())); |
354 if (auth_key->GetKeyType() == Key::KEY_TYPE_PASSWORD_PLAIN) | 354 if (auth_key->GetKeyType() == Key::KEY_TYPE_PASSWORD_PLAIN) |
355 auth_key->Transform(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt); | 355 auth_key->Transform(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt); |
356 | 356 |
357 cryptohome::Authorization auth(auth_key->GetSecret(), auth_key->GetLabel()); | 357 cryptohome::Authorization auth(auth_key->GetSecret(), auth_key->GetLabel()); |
358 cryptohome::HomedirMethods::GetInstance()->AddKeyEx( | 358 cryptohome::HomedirMethods::GetInstance()->AddKeyEx( |
359 id, | 359 id, |
360 auth, | 360 auth, |
(...skipping 24 matching lines...) Expand all Loading... |
385 user_context_.GetKey()->GetLabel() == | 385 user_context_.GetKey()->GetLabel() == |
386 EasyUnlockKeyManager::GetKeyLabel(key_creation_index_)) { | 386 EasyUnlockKeyManager::GetKeyLabel(key_creation_index_)) { |
387 user_context_.SetKey(user_key); | 387 user_context_.SetKey(user_key); |
388 } | 388 } |
389 | 389 |
390 ++key_creation_index_; | 390 ++key_creation_index_; |
391 CreateKeyForDeviceAtIndex(key_creation_index_); | 391 CreateKeyForDeviceAtIndex(key_creation_index_); |
392 } | 392 } |
393 | 393 |
394 } // namespace chromeos | 394 } // namespace chromeos |
OLD | NEW |