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/supervised/supervised_user_creation_cont
roller_new.h" | 5 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_cont
roller_new.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 VLOG(1) << " Phase 2.2 : Created home dir with master key"; | 263 VLOG(1) << " Phase 2.2 : Created home dir with master key"; |
264 | 264 |
265 creation_context_->mount_hash = mount_hash; | 265 creation_context_->mount_hash = mount_hash; |
266 | 266 |
267 // Plain text password, hashed and salted with individual salt. | 267 // Plain text password, hashed and salted with individual salt. |
268 // It can be used for mounting homedir, and can be replaced only when signed. | 268 // It can be used for mounting homedir, and can be replaced only when signed. |
269 cryptohome::KeyDefinition password_key( | 269 cryptohome::KeyDefinition password_key( |
270 creation_context_->salted_password, | 270 creation_context_->salted_password, |
271 kCryptohomeSupervisedUserKeyLabel, | 271 kCryptohomeSupervisedUserKeyLabel, |
272 kCryptohomeSupervisedUserKeyPrivileges); | 272 kCryptohomeSupervisedUserKeyPrivileges); |
273 base::Base64Decode(creation_context_->encryption_key, | 273 std::string encryption_key; |
274 &password_key.encryption_key); | 274 base::Base64Decode(creation_context_->encryption_key, &encryption_key); |
275 base::Base64Decode(creation_context_->signature_key, | 275 password_key.authorization_data.push_back( |
276 &password_key.signature_key); | 276 cryptohome::KeyDefinition::AuthorizationData(true /* encrypt */, |
| 277 false /* sign */, |
| 278 encryption_key)); |
| 279 std::string signature_key; |
| 280 base::Base64Decode(creation_context_->signature_key, &signature_key); |
| 281 password_key.authorization_data.push_back( |
| 282 cryptohome::KeyDefinition::AuthorizationData(false /* encrypt */, |
| 283 true /* sign */, |
| 284 signature_key)); |
277 | 285 |
278 Key key(Key::KEY_TYPE_SALTED_PBKDF2_AES256_1234, | 286 Key key(Key::KEY_TYPE_SALTED_PBKDF2_AES256_1234, |
279 std::string(), // The salt is stored elsewhere. | 287 std::string(), // The salt is stored elsewhere. |
280 creation_context_->salted_master_key); | 288 creation_context_->salted_master_key); |
281 key.SetLabel(kCryptohomeMasterKeyLabel); | 289 key.SetLabel(kCryptohomeMasterKeyLabel); |
282 UserContext context(creation_context_->local_user_id); | 290 UserContext context(creation_context_->local_user_id); |
283 context.SetKey(key); | 291 context.SetKey(key); |
284 context.SetIsUsingOAuth(false); | 292 context.SetIsUsingOAuth(false); |
285 | 293 |
286 authenticator_->AddKey( | 294 authenticator_->AddKey( |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 creation_context_->registration_utility.reset(); | 411 creation_context_->registration_utility.reset(); |
404 chrome::AttemptUserExit(); | 412 chrome::AttemptUserExit(); |
405 } | 413 } |
406 | 414 |
407 std::string SupervisedUserCreationControllerNew::GetSupervisedUserId() { | 415 std::string SupervisedUserCreationControllerNew::GetSupervisedUserId() { |
408 DCHECK(creation_context_); | 416 DCHECK(creation_context_); |
409 return creation_context_->local_user_id; | 417 return creation_context_->local_user_id; |
410 } | 418 } |
411 | 419 |
412 } // namespace chromeos | 420 } // namespace chromeos |
OLD | NEW |