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

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

Issue 729803002: Easy Sign-in: Use TPM RSA key to sign nonce in sign-in protocol (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years 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
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/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.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 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
41 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00,
42 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xdc, 0xfa, 0x10,
43 0xff, 0xa7, 0x46, 0x65, 0xae, 0xef, 0x87, 0x09, 0x74, 0xea, 0x99, 0xb2,
44 0xce, 0x54, 0x54, 0x7c, 0x67, 0xf4, 0x2a, 0xaa, 0x6d, 0xd0, 0x1a, 0x2e,
45 0xd3, 0x1f, 0xd2, 0xc2, 0x42, 0xaf, 0x5d, 0x96, 0x0b, 0x1f, 0x89, 0x6e,
46 0xfb, 0xa3, 0x54, 0x3d, 0x65, 0x54, 0xb7, 0xb1, 0x26, 0x87, 0xa5, 0xc6,
47 0x88, 0x56, 0x8f, 0x32, 0xe0, 0x26, 0xc5, 0x32, 0xd2, 0x59, 0x93, 0xb9,
48 0x7a, 0x7c, 0x28, 0x42, 0xec, 0x2b, 0x8e, 0x12, 0x35, 0xee, 0xe2, 0x41,
49 0x4d, 0x25, 0x80, 0x6c, 0x6f, 0xba, 0xe4, 0x38, 0x95, 0x4e, 0xba, 0x9d,
50 0x27, 0x55, 0xdf, 0xfe, 0xeb, 0x1b, 0x47, 0x70, 0x09, 0x57, 0x81, 0x5a,
51 0x8a, 0x23, 0x3f, 0x97, 0xb1, 0xa2, 0xc7, 0x14, 0xb3, 0xe2, 0xbe, 0x2e,
52 0x42, 0xd8, 0xbe, 0x30, 0xb1, 0x96, 0x15, 0x82, 0xea, 0x99, 0x48, 0x91,
53 0x0e, 0x0c, 0x79, 0x7c, 0x50, 0xfc, 0x4b, 0xb4, 0x55, 0xf0, 0xfc, 0x45,
54 0xe5, 0xe3, 0x4e, 0x63, 0x96, 0xac, 0x5b, 0x2d, 0x46, 0x23, 0x93, 0x65,
55 0xc7, 0xf3, 0xda, 0xaf, 0x09, 0x09, 0x40, 0x0d, 0x61, 0xcf, 0x9e, 0x0c,
56 0xa8, 0x08, 0x3e, 0xaf, 0x33, 0x5a, 0x6f, 0xce, 0xb6, 0x86, 0x3c, 0x1c,
57 0xc0, 0xcf, 0x5a, 0x17, 0x1a, 0xff, 0x35, 0xd9, 0x7e, 0xcb, 0x60, 0xef,
58 0x25, 0x1c, 0x7e, 0xc2, 0xc8, 0xa5, 0x88, 0x36, 0x1d, 0xc4, 0x12, 0x66,
59 0xa4, 0xb7, 0xed, 0x38, 0xb0, 0x26, 0xce, 0x0d, 0x53, 0x78, 0x64, 0x49,
60 0xdb, 0xb1, 0x1a, 0x06, 0xea, 0x33, 0xcc, 0xf1, 0xec, 0xa5, 0x75, 0x20,
61 0x1e, 0xd1, 0xaa, 0x47, 0x3e, 0xd1, 0x18, 0x7e, 0xc1, 0xd8, 0xa7, 0x44,
62 0xea, 0x34, 0x5b, 0xed, 0x7e, 0xa0, 0x0e, 0xe4, 0xe8, 0x1b, 0xba, 0x46,
63 0x48, 0x60, 0x1d, 0xd5, 0x37, 0xdc, 0x91, 0x01, 0x5d, 0x31, 0xf0, 0xc2,
64 0xc1, 0x02, 0x03, 0x01, 0x00, 0x01
65 };
66
67 } // namespace 38 } // namespace
68 39
69 ///////////////////////////////////////////////////////////////////////////// 40 /////////////////////////////////////////////////////////////////////////////
70 // EasyUnlockCreateKeysOperation::ChallengeCreator 41 // EasyUnlockCreateKeysOperation::ChallengeCreator
71 42
72 class EasyUnlockCreateKeysOperation::ChallengeCreator { 43 class EasyUnlockCreateKeysOperation::ChallengeCreator {
73 public: 44 public:
74 typedef base::Callback<void (bool success)> ChallengeCreatedCallback; 45 typedef base::Callback<void (bool success)> ChallengeCreatedCallback;
75 ChallengeCreator(const std::string& user_key, 46 ChallengeCreator(const std::string& user_key,
76 const std::string& session_key, 47 const std::string& session_key,
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 226
256 device_->challenge = challenge; 227 device_->challenge = challenge;
257 callback_.Run(true); 228 callback_.Run(true);
258 } 229 }
259 230
260 ///////////////////////////////////////////////////////////////////////////// 231 /////////////////////////////////////////////////////////////////////////////
261 // EasyUnlockCreateKeysOperation 232 // EasyUnlockCreateKeysOperation
262 233
263 EasyUnlockCreateKeysOperation::EasyUnlockCreateKeysOperation( 234 EasyUnlockCreateKeysOperation::EasyUnlockCreateKeysOperation(
264 const UserContext& user_context, 235 const UserContext& user_context,
236 const std::string& tpm_public_key,
265 const EasyUnlockDeviceKeyDataList& devices, 237 const EasyUnlockDeviceKeyDataList& devices,
266 const CreateKeysCallback& callback) 238 const CreateKeysCallback& callback)
267 : user_context_(user_context), 239 : user_context_(user_context),
240 tpm_public_key_(tpm_public_key),
268 devices_(devices), 241 devices_(devices),
269 callback_(callback), 242 callback_(callback),
270 key_creation_index_(0), 243 key_creation_index_(0),
271 weak_ptr_factory_(this) { 244 weak_ptr_factory_(this) {
272 // Must have the secret and callback. 245 // Must have the secret and callback.
273 DCHECK(!user_context_.GetKey()->GetSecret().empty()); 246 DCHECK(!user_context_.GetKey()->GetSecret().empty());
274 DCHECK(!callback_.is_null()); 247 DCHECK(!callback_.is_null());
275 } 248 }
276 249
277 EasyUnlockCreateKeysOperation::~EasyUnlockCreateKeysOperation() { 250 EasyUnlockCreateKeysOperation::~EasyUnlockCreateKeysOperation() {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 callback_.Run(false); 284 callback_.Run(false);
312 return; 285 return;
313 } 286 }
314 287
315 std::string raw_session_key; 288 std::string raw_session_key;
316 session_key->GetRawKey(&raw_session_key); 289 session_key->GetRawKey(&raw_session_key);
317 290
318 challenge_creator_.reset(new ChallengeCreator( 291 challenge_creator_.reset(new ChallengeCreator(
319 user_key, 292 user_key,
320 raw_session_key, 293 raw_session_key,
321 std::string(kTpmPubKey, arraysize(kTpmPubKey)), 294 tpm_public_key_,
322 device, 295 device,
323 base::Bind(&EasyUnlockCreateKeysOperation::OnChallengeCreated, 296 base::Bind(&EasyUnlockCreateKeysOperation::OnChallengeCreated,
324 weak_ptr_factory_.GetWeakPtr(), 297 weak_ptr_factory_.GetWeakPtr(),
325 index))); 298 index)));
326 challenge_creator_->Start(); 299 challenge_creator_->Start();
327 } 300 }
328 301
329 void EasyUnlockCreateKeysOperation::OnChallengeCreated(size_t index, 302 void EasyUnlockCreateKeysOperation::OnChallengeCreated(size_t index,
330 bool success) { 303 bool success) {
331 DCHECK_EQ(key_creation_index_, index); 304 DCHECK_EQ(key_creation_index_, index);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 user_context_.GetKey()->GetLabel() == 385 user_context_.GetKey()->GetLabel() ==
413 EasyUnlockKeyManager::GetKeyLabel(key_creation_index_)) { 386 EasyUnlockKeyManager::GetKeyLabel(key_creation_index_)) {
414 user_context_.SetKey(user_key); 387 user_context_.SetKey(user_key);
415 } 388 }
416 389
417 ++key_creation_index_; 390 ++key_creation_index_;
418 CreateKeyForDeviceAtIndex(key_creation_index_); 391 CreateKeyForDeviceAtIndex(key_creation_index_);
419 } 392 }
420 393
421 } // namespace chromeos 394 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698