OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chromeos/dbus/cryptohome_client.h" | 5 #include "chromeos/dbus/cryptohome_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "chromeos/cryptohome/async_method_caller.h" | 9 #include "chromeos/cryptohome/async_method_caller.h" |
10 #include "chromeos/dbus/blocking_method_caller.h" | 10 #include "chromeos/dbus/blocking_method_caller.h" |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 reinterpret_cast<const uint8*>(pca_response.data()), | 456 reinterpret_cast<const uint8*>(pca_response.data()), |
457 pca_response.size()); | 457 pca_response.size()); |
458 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 458 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
459 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, | 459 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, |
460 weak_ptr_factory_.GetWeakPtr(), | 460 weak_ptr_factory_.GetWeakPtr(), |
461 callback)); | 461 callback)); |
462 } | 462 } |
463 | 463 |
464 // CryptohomeClient override. | 464 // CryptohomeClient override. |
465 virtual void AsyncTpmAttestationCreateCertRequest( | 465 virtual void AsyncTpmAttestationCreateCertRequest( |
466 int options, | 466 attestation::AttestationCertificateProfile certificate_profile, |
| 467 const std::string& user_email, |
| 468 const std::string& request_origin, |
467 const AsyncMethodCallback& callback) OVERRIDE { | 469 const AsyncMethodCallback& callback) OVERRIDE { |
468 dbus::MethodCall method_call( | 470 dbus::MethodCall method_call( |
469 cryptohome::kCryptohomeInterface, | 471 cryptohome::kCryptohomeInterface, |
470 cryptohome::kCryptohomeAsyncTpmAttestationCreateCertRequest); | 472 cryptohome::kCryptohomeAsyncTpmAttestationCreateCertRequestByProfile); |
471 dbus::MessageWriter writer(&method_call); | 473 dbus::MessageWriter writer(&method_call); |
472 bool include_stable_id = | 474 writer.AppendInt32(certificate_profile); |
473 (options & attestation::CERTIFICATE_INCLUDE_STABLE_ID); | 475 writer.AppendString(user_email); |
474 writer.AppendBool(include_stable_id); | 476 writer.AppendString(request_origin); |
475 bool include_device_state = | |
476 (options & attestation::CERTIFICATE_INCLUDE_DEVICE_STATE); | |
477 writer.AppendBool(include_device_state); | |
478 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 477 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
479 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, | 478 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, |
480 weak_ptr_factory_.GetWeakPtr(), | 479 weak_ptr_factory_.GetWeakPtr(), |
481 callback)); | 480 callback)); |
482 } | 481 } |
483 | 482 |
484 // CryptohomeClient override. | 483 // CryptohomeClient override. |
485 virtual void AsyncTpmAttestationFinishCertRequest( | 484 virtual void AsyncTpmAttestationFinishCertRequest( |
486 const std::string& pca_response, | 485 const std::string& pca_response, |
487 attestation::AttestationKeyType key_type, | 486 attestation::AttestationKeyType key_type, |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 | 1111 |
1113 // CryptohomeClient override. | 1112 // CryptohomeClient override. |
1114 virtual void AsyncTpmAttestationEnroll( | 1113 virtual void AsyncTpmAttestationEnroll( |
1115 const std::string& pca_response, | 1114 const std::string& pca_response, |
1116 const AsyncMethodCallback& callback) OVERRIDE { | 1115 const AsyncMethodCallback& callback) OVERRIDE { |
1117 ReturnAsyncMethodResult(callback, false); | 1116 ReturnAsyncMethodResult(callback, false); |
1118 } | 1117 } |
1119 | 1118 |
1120 // CryptohomeClient override. | 1119 // CryptohomeClient override. |
1121 virtual void AsyncTpmAttestationCreateCertRequest( | 1120 virtual void AsyncTpmAttestationCreateCertRequest( |
1122 int options, | 1121 attestation::AttestationCertificateProfile certificate_profile, |
| 1122 const std::string& user_email, |
| 1123 const std::string& request_origin, |
1123 const AsyncMethodCallback& callback) OVERRIDE { | 1124 const AsyncMethodCallback& callback) OVERRIDE { |
1124 ReturnAsyncMethodResult(callback, true); | 1125 ReturnAsyncMethodResult(callback, true); |
1125 } | 1126 } |
1126 | 1127 |
1127 // CryptohomeClient override. | 1128 // CryptohomeClient override. |
1128 virtual void AsyncTpmAttestationFinishCertRequest( | 1129 virtual void AsyncTpmAttestationFinishCertRequest( |
1129 const std::string& pca_response, | 1130 const std::string& pca_response, |
1130 attestation::AttestationKeyType key_type, | 1131 attestation::AttestationKeyType key_type, |
1131 const std::string& key_name, | 1132 const std::string& key_name, |
1132 const AsyncMethodCallback& callback) OVERRIDE { | 1133 const AsyncMethodCallback& callback) OVERRIDE { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 return new CryptohomeClientStubImpl(); | 1276 return new CryptohomeClientStubImpl(); |
1276 } | 1277 } |
1277 | 1278 |
1278 // static | 1279 // static |
1279 std::string CryptohomeClient::GetStubSanitizedUsername( | 1280 std::string CryptohomeClient::GetStubSanitizedUsername( |
1280 const std::string& username) { | 1281 const std::string& username) { |
1281 return username + kUserIdStubHashSuffix; | 1282 return username + kUserIdStubHashSuffix; |
1282 } | 1283 } |
1283 | 1284 |
1284 } // namespace chromeos | 1285 } // namespace chromeos |
OLD | NEW |