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.AddSymmetricKey(true /* encrypt */, |
dzhioev (left Google)
2014/09/03 17:42:46
Nit: Is situation when (encrypt == sign) possible?
bartfab (slow)
2014/09/04 10:14:18
Depending on the HMAC used, it may or may not be s
| |
276 &password_key.signature_key); | 276 false /* sign */, |
277 encryption_key); | |
278 std::string signature_key; | |
279 base::Base64Decode(creation_context_->signature_key, &signature_key); | |
280 password_key.AddSymmetricKey(false /* encrypt */, | |
281 true /* sign */, | |
282 signature_key); | |
277 | 283 |
278 Key key(Key::KEY_TYPE_SALTED_PBKDF2_AES256_1234, | 284 Key key(Key::KEY_TYPE_SALTED_PBKDF2_AES256_1234, |
279 std::string(), // The salt is stored elsewhere. | 285 std::string(), // The salt is stored elsewhere. |
280 creation_context_->salted_master_key); | 286 creation_context_->salted_master_key); |
281 key.SetLabel(kCryptohomeMasterKeyLabel); | 287 key.SetLabel(kCryptohomeMasterKeyLabel); |
282 UserContext context(creation_context_->local_user_id); | 288 UserContext context(creation_context_->local_user_id); |
283 context.SetKey(key); | 289 context.SetKey(key); |
284 context.SetIsUsingOAuth(false); | 290 context.SetIsUsingOAuth(false); |
285 | 291 |
286 authenticator_->AddKey( | 292 authenticator_->AddKey( |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
403 creation_context_->registration_utility.reset(); | 409 creation_context_->registration_utility.reset(); |
404 chrome::AttemptUserExit(); | 410 chrome::AttemptUserExit(); |
405 } | 411 } |
406 | 412 |
407 std::string SupervisedUserCreationControllerNew::GetSupervisedUserId() { | 413 std::string SupervisedUserCreationControllerNew::GetSupervisedUserId() { |
408 DCHECK(creation_context_); | 414 DCHECK(creation_context_); |
409 return creation_context_->local_user_id; | 415 return creation_context_->local_user_id; |
410 } | 416 } |
411 | 417 |
412 } // namespace chromeos | 418 } // namespace chromeos |
OLD | NEW |