Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_operation.cc

Issue 576383002: easy-signin: Wire GetSignInChallenge. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, add fake key Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 17 matching lines...) Expand all
28 28
29 namespace { 29 namespace {
30 30
31 const int kUserKeyByteSize = 16; 31 const int kUserKeyByteSize = 16;
32 const int kSessionKeyByteSize = 16; 32 const int kSessionKeyByteSize = 16;
33 33
34 const int kEasyUnlockKeyRevision = 1; 34 const int kEasyUnlockKeyRevision = 1;
35 const int kEasyUnlockKeyPrivileges = 35 const int kEasyUnlockKeyPrivileges =
36 cryptohome::PRIV_MOUNT | cryptohome::PRIV_ADD | cryptohome::PRIV_REMOVE; 36 cryptohome::PRIV_MOUNT | cryptohome::PRIV_ADD | cryptohome::PRIV_REMOVE;
37 37
38 // TODO(xiyuan): Use real keys. http://crbug.com/409027
39 const char kTpmPubKey[] = {
40 0x08, 0x02, 0x1a, 0x88, 0x02, 0x0a, 0x81, 0x02, 0x00, 0xdc, 0xfa, 0x10,
41 0xff, 0xa7, 0x46, 0x65, 0xae, 0xef, 0x87, 0x09, 0x74, 0xea, 0x99, 0xb2,
42 0xce, 0x54, 0x54, 0x7c, 0x67, 0xf4, 0x2a, 0xaa, 0x6d, 0xd0, 0x1a, 0x2e,
43 0xd3, 0x1f, 0xd2, 0xc2, 0x42, 0xaf, 0x5d, 0x96, 0x0b, 0x1f, 0x89, 0x6e,
44 0xfb, 0xa3, 0x54, 0x3d, 0x65, 0x54, 0xb7, 0xb1, 0x26, 0x87, 0xa5, 0xc6,
45 0x88, 0x56, 0x8f, 0x32, 0xe0, 0x26, 0xc5, 0x32, 0xd2, 0x59, 0x93, 0xb9,
46 0x7a, 0x7c, 0x28, 0x42, 0xec, 0x2b, 0x8e, 0x12, 0x35, 0xee, 0xe2, 0x41,
47 0x4d, 0x25, 0x80, 0x6c, 0x6f, 0xba, 0xe4, 0x38, 0x95, 0x4e, 0xba, 0x9d,
48 0x27, 0x55, 0xdf, 0xfe, 0xeb, 0x1b, 0x47, 0x70, 0x09, 0x57, 0x81, 0x5a,
49 0x8a, 0x23, 0x3f, 0x97, 0xb1, 0xa2, 0xc7, 0x14, 0xb3, 0xe2, 0xbe, 0x2e,
50 0x42, 0xd8, 0xbe, 0x30, 0xb1, 0x96, 0x15, 0x82, 0xea, 0x99, 0x48, 0x91,
51 0x0e, 0x0c, 0x79, 0x7c, 0x50, 0xfc, 0x4b, 0xb4, 0x55, 0xf0, 0xfc, 0x45,
52 0xe5, 0xe3, 0x4e, 0x63, 0x96, 0xac, 0x5b, 0x2d, 0x46, 0x23, 0x93, 0x65,
53 0xc7, 0xf3, 0xda, 0xaf, 0x09, 0x09, 0x40, 0x0d, 0x61, 0xcf, 0x9e, 0x0c,
54 0xa8, 0x08, 0x3e, 0xaf, 0x33, 0x5a, 0x6f, 0xce, 0xb6, 0x86, 0x3c, 0x1c,
55 0xc0, 0xcf, 0x5a, 0x17, 0x1a, 0xff, 0x35, 0xd9, 0x7e, 0xcb, 0x60, 0xef,
56 0x25, 0x1c, 0x7e, 0xc2, 0xc8, 0xa5, 0x88, 0x36, 0x1d, 0xc4, 0x12, 0x66,
57 0xa4, 0xb7, 0xed, 0x38, 0xb0, 0x26, 0xce, 0x0d, 0x53, 0x78, 0x64, 0x49,
58 0xdb, 0xb1, 0x1a, 0x06, 0xea, 0x33, 0xcc, 0xf1, 0xec, 0xa5, 0x75, 0x20,
59 0x1e, 0xd1, 0xaa, 0x47, 0x3e, 0xd1, 0x18, 0x7e, 0xc1, 0xd8, 0xa7, 0x44,
60 0xea, 0x34, 0x5b, 0xed, 0x7e, 0xa0, 0x0e, 0xe4, 0xe8, 0x1b, 0xba, 0x46,
61 0x48, 0x60, 0x1d, 0xd5, 0x37, 0xdc, 0x91, 0x01, 0x5d, 0x31, 0xf0, 0xc2,
62 0xc1, 0x10, 0x81, 0x80, 0x04
63 };
64
38 bool WebSafeBase64Decode(const std::string& encoded, std::string* decoded) { 65 bool WebSafeBase64Decode(const std::string& encoded, std::string* decoded) {
39 std::string adjusted_encoded = encoded; 66 std::string adjusted_encoded = encoded;
40 base::ReplaceChars(adjusted_encoded, "-", "+", &adjusted_encoded); 67 base::ReplaceChars(adjusted_encoded, "-", "+", &adjusted_encoded);
41 base::ReplaceChars(adjusted_encoded, "_", "/", &adjusted_encoded); 68 base::ReplaceChars(adjusted_encoded, "_", "/", &adjusted_encoded);
42 69
43 return base::Base64Decode(adjusted_encoded, decoded); 70 return base::Base64Decode(adjusted_encoded, decoded);
44 } 71 }
45 72
46 } // namespace 73 } // namespace
47 74
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 callback_.Run(false); 296 callback_.Run(false);
270 return; 297 return;
271 } 298 }
272 299
273 std::string raw_session_key; 300 std::string raw_session_key;
274 session_key->GetRawKey(&raw_session_key); 301 session_key->GetRawKey(&raw_session_key);
275 302
276 challenge_creator_.reset(new ChallengeCreator( 303 challenge_creator_.reset(new ChallengeCreator(
277 user_key, 304 user_key,
278 raw_session_key, 305 raw_session_key,
279 std::string(), 306 kTpmPubKey,
280 device, 307 device,
281 base::Bind(&EasyUnlockCreateKeysOperation::OnChallengeCreated, 308 base::Bind(&EasyUnlockCreateKeysOperation::OnChallengeCreated,
282 weak_ptr_factory_.GetWeakPtr(), 309 weak_ptr_factory_.GetWeakPtr(),
283 index))); 310 index)));
284 challenge_creator_->Start(); 311 challenge_creator_->Start();
285 } 312 }
286 313
287 void EasyUnlockCreateKeysOperation::OnChallengeCreated(size_t index, 314 void EasyUnlockCreateKeysOperation::OnChallengeCreated(size_t index,
288 bool success) { 315 bool success) {
289 DCHECK_EQ(key_creation_index_, index); 316 DCHECK_EQ(key_creation_index_, index);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 LOG(ERROR) << "Easy unlock failed to create key, code=" << return_code; 384 LOG(ERROR) << "Easy unlock failed to create key, code=" << return_code;
358 callback_.Run(false); 385 callback_.Run(false);
359 return; 386 return;
360 } 387 }
361 388
362 ++key_creation_index_; 389 ++key_creation_index_;
363 CreateKeyForDeviceAtIndex(key_creation_index_); 390 CreateKeyForDeviceAtIndex(key_creation_index_);
364 } 391 }
365 392
366 } // namespace chromeos 393 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698