| 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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 reinterpret_cast<const uint8*>(pca_response.data()), | 440 reinterpret_cast<const uint8*>(pca_response.data()), |
| 441 pca_response.size()); | 441 pca_response.size()); |
| 442 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 442 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 443 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, | 443 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, |
| 444 weak_ptr_factory_.GetWeakPtr(), | 444 weak_ptr_factory_.GetWeakPtr(), |
| 445 callback)); | 445 callback)); |
| 446 } | 446 } |
| 447 | 447 |
| 448 // CryptohomeClient override. | 448 // CryptohomeClient override. |
| 449 virtual void AsyncTpmAttestationCreateCertRequest( | 449 virtual void AsyncTpmAttestationCreateCertRequest( |
| 450 int options, | 450 int certificate_profile, |
| 451 const std::string& user_email, |
| 452 const std::string& request_origin, |
| 451 const AsyncMethodCallback& callback) OVERRIDE { | 453 const AsyncMethodCallback& callback) OVERRIDE { |
| 452 dbus::MethodCall method_call( | 454 dbus::MethodCall method_call( |
| 453 cryptohome::kCryptohomeInterface, | 455 cryptohome::kCryptohomeInterface, |
| 454 cryptohome::kCryptohomeAsyncTpmAttestationCreateCertRequest); | 456 cryptohome::kCryptohomeAsyncTpmAttestationCreateCertRequestByProfile); |
| 455 dbus::MessageWriter writer(&method_call); | 457 dbus::MessageWriter writer(&method_call); |
| 456 bool include_stable_id = | 458 writer.AppendInt32(certificate_profile); |
| 457 (options & attestation::CERTIFICATE_INCLUDE_STABLE_ID); | 459 writer.AppendString(user_email); |
| 458 writer.AppendBool(include_stable_id); | 460 writer.AppendString(request_origin); |
| 459 bool include_device_state = | |
| 460 (options & attestation::CERTIFICATE_INCLUDE_DEVICE_STATE); | |
| 461 writer.AppendBool(include_device_state); | |
| 462 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 461 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 463 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, | 462 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, |
| 464 weak_ptr_factory_.GetWeakPtr(), | 463 weak_ptr_factory_.GetWeakPtr(), |
| 465 callback)); | 464 callback)); |
| 466 } | 465 } |
| 467 | 466 |
| 468 // CryptohomeClient override. | 467 // CryptohomeClient override. |
| 469 virtual void AsyncTpmAttestationFinishCertRequest( | 468 virtual void AsyncTpmAttestationFinishCertRequest( |
| 470 const std::string& pca_response, | 469 const std::string& pca_response, |
| 471 attestation::AttestationKeyType key_type, | 470 attestation::AttestationKeyType key_type, |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1086 | 1085 |
| 1087 // CryptohomeClient override. | 1086 // CryptohomeClient override. |
| 1088 virtual void AsyncTpmAttestationEnroll( | 1087 virtual void AsyncTpmAttestationEnroll( |
| 1089 const std::string& pca_response, | 1088 const std::string& pca_response, |
| 1090 const AsyncMethodCallback& callback) OVERRIDE { | 1089 const AsyncMethodCallback& callback) OVERRIDE { |
| 1091 ReturnAsyncMethodResult(callback, false); | 1090 ReturnAsyncMethodResult(callback, false); |
| 1092 } | 1091 } |
| 1093 | 1092 |
| 1094 // CryptohomeClient override. | 1093 // CryptohomeClient override. |
| 1095 virtual void AsyncTpmAttestationCreateCertRequest( | 1094 virtual void AsyncTpmAttestationCreateCertRequest( |
| 1096 int options, | 1095 int certificate_profile, |
| 1096 const std::string& user_email, |
| 1097 const std::string& request_origin, |
| 1097 const AsyncMethodCallback& callback) OVERRIDE { | 1098 const AsyncMethodCallback& callback) OVERRIDE { |
| 1098 ReturnAsyncMethodResult(callback, true); | 1099 ReturnAsyncMethodResult(callback, true); |
| 1099 } | 1100 } |
| 1100 | 1101 |
| 1101 // CryptohomeClient override. | 1102 // CryptohomeClient override. |
| 1102 virtual void AsyncTpmAttestationFinishCertRequest( | 1103 virtual void AsyncTpmAttestationFinishCertRequest( |
| 1103 const std::string& pca_response, | 1104 const std::string& pca_response, |
| 1104 attestation::AttestationKeyType key_type, | 1105 attestation::AttestationKeyType key_type, |
| 1105 const std::string& key_name, | 1106 const std::string& key_name, |
| 1106 const AsyncMethodCallback& callback) OVERRIDE { | 1107 const AsyncMethodCallback& callback) OVERRIDE { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 return new CryptohomeClientStubImpl(); | 1250 return new CryptohomeClientStubImpl(); |
| 1250 } | 1251 } |
| 1251 | 1252 |
| 1252 // static | 1253 // static |
| 1253 std::string CryptohomeClient::GetStubSanitizedUsername( | 1254 std::string CryptohomeClient::GetStubSanitizedUsername( |
| 1254 const std::string& username) { | 1255 const std::string& username) { |
| 1255 return username + kUserIdStubHashSuffix; | 1256 return username + kUserIdStubHashSuffix; |
| 1256 } | 1257 } |
| 1257 | 1258 |
| 1258 } // namespace chromeos | 1259 } // namespace chromeos |
| OLD | NEW |