| Index: chrome/browser/chromeos/login/managed/managed_user_creation_controller_new.cc
|
| diff --git a/chrome/browser/chromeos/login/managed/managed_user_creation_controller_new.cc b/chrome/browser/chromeos/login/managed/managed_user_creation_controller_new.cc
|
| index e1501308d190804899a9b8f48c5fd152c9c57884..34a3fe04fb9a6be3e0fd61449604885045cba807 100644
|
| --- a/chrome/browser/chromeos/login/managed/managed_user_creation_controller_new.cc
|
| +++ b/chrome/browser/chromeos/login/managed/managed_user_creation_controller_new.cc
|
| @@ -14,6 +14,7 @@
|
| #include "base/task_runner_util.h"
|
| #include "base/threading/sequenced_worker_pool.h"
|
| #include "base/values.h"
|
| +#include "chrome/browser/chromeos/login/auth/key.h"
|
| #include "chrome/browser/chromeos/login/auth/mount_manager.h"
|
| #include "chrome/browser/chromeos/login/auth/user_context.h"
|
| #include "chrome/browser/chromeos/login/managed/locally_managed_user_constants.h"
|
| @@ -200,16 +201,18 @@ void ManagedUserCreationControllerNew::StartCreationImpl() {
|
| this,
|
| &ManagedUserCreationControllerNew::CreationTimedOut);
|
| authenticator_ = new ExtendedAuthenticator(this);
|
| - authenticator_->HashPasswordWithSalt(
|
| - creation_context_->master_key,
|
| - base::Bind(&ManagedUserCreationControllerNew::OnPasswordHashingSuccess,
|
| + UserContext user_context;
|
| + user_context.SetKey(Key(creation_context_->master_key));
|
| + authenticator_->TransformKeyIfNeeded(
|
| + user_context,
|
| + base::Bind(&ManagedUserCreationControllerNew::OnKeyTransformedIfNeeded,
|
| weak_factory_.GetWeakPtr()));
|
| }
|
|
|
| -void ManagedUserCreationControllerNew::OnPasswordHashingSuccess(
|
| - const std::string& password_hash) {
|
| +void ManagedUserCreationControllerNew::OnKeyTransformedIfNeeded(
|
| + const UserContext& user_context) {
|
| VLOG(1) << " Phase 2.1 : Got hashed master key";
|
| - creation_context_->salted_master_key = password_hash;
|
| + creation_context_->salted_master_key = user_context.GetKey()->GetSecret();
|
|
|
| // Create home dir with two keys.
|
| std::vector<cryptohome::KeyDefinition> keys;
|
| @@ -268,10 +271,12 @@ void ManagedUserCreationControllerNew::OnMountSuccess(
|
| base::Base64Decode(creation_context_->signature_key,
|
| &password_key.signature_key);
|
|
|
| + Key key(Key::KEY_TYPE_SALTED_PBKDF2_AES256_1234,
|
| + creation_context_->salted_master_key,
|
| + std::string()); // The salt is stored elsewhere.
|
| + key.SetLabel(kCryptohomeMasterKeyLabel);
|
| UserContext context(creation_context_->local_user_id);
|
| - context.SetPassword(creation_context_->salted_master_key);
|
| - context.SetDoesNeedPasswordHashing(false);
|
| - context.SetKeyLabel(kCryptohomeMasterKeyLabel);
|
| + context.SetKey(key);
|
| context.SetIsUsingOAuth(false);
|
|
|
| authenticator_->AddKey(
|
|
|