| 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/attestation/attestation_flow.h" | 5 #include "chromeos/attestation/attestation_flow.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "chromeos/cryptohome/async_method_caller.h" | 10 #include "chromeos/cryptohome/async_method_caller.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 if (status != DBUS_METHOD_CALL_SUCCESS) { | 50 if (status != DBUS_METHOD_CALL_SUCCESS) { |
| 51 LOG(ERROR) << "Attestation: DBus data operation failed."; | 51 LOG(ERROR) << "Attestation: DBus data operation failed."; |
| 52 if (!callback.is_null()) | 52 if (!callback.is_null()) |
| 53 callback.Run(false, ""); | 53 callback.Run(false, ""); |
| 54 return; | 54 return; |
| 55 } | 55 } |
| 56 if (!callback.is_null()) | 56 if (!callback.is_null()) |
| 57 callback.Run(result, data); | 57 callback.Run(result, data); |
| 58 } | 58 } |
| 59 | 59 |
| 60 AttestationKeyType GetKeyTypeForProfile( | 60 } // namespace |
| 61 AttestationCertificateProfile profile) { | 61 |
| 62 switch (profile) { | 62 AttestationKeyType AttestationFlow::GetKeyTypeForProfile( |
| 63 AttestationCertificateProfile certificate_profile) { |
| 64 switch (certificate_profile) { |
| 63 case PROFILE_ENTERPRISE_MACHINE_CERTIFICATE: | 65 case PROFILE_ENTERPRISE_MACHINE_CERTIFICATE: |
| 64 case PROFILE_ENTERPRISE_ENROLLMENT_CERTIFICATE: | 66 case PROFILE_ENTERPRISE_ENROLLMENT_CERTIFICATE: |
| 65 return KEY_DEVICE; | 67 return KEY_DEVICE; |
| 66 case PROFILE_ENTERPRISE_USER_CERTIFICATE: | 68 case PROFILE_ENTERPRISE_USER_CERTIFICATE: |
| 67 case PROFILE_CONTENT_PROTECTION_CERTIFICATE: | 69 case PROFILE_CONTENT_PROTECTION_CERTIFICATE: |
| 68 return KEY_USER; | 70 return KEY_USER; |
| 69 } | 71 } |
| 70 NOTREACHED(); | 72 NOTREACHED(); |
| 71 return KEY_USER; | 73 return KEY_USER; |
| 72 } | 74 } |
| 73 | 75 |
| 74 std::string GetKeyNameForProfile(AttestationCertificateProfile profile, | 76 std::string AttestationFlow::GetKeyNameForProfile( |
| 75 const std::string& origin) { | 77 AttestationCertificateProfile certificate_profile, |
| 76 switch (profile) { | 78 const std::string& request_origin) { |
| 79 switch (certificate_profile) { |
| 77 case PROFILE_ENTERPRISE_MACHINE_CERTIFICATE: | 80 case PROFILE_ENTERPRISE_MACHINE_CERTIFICATE: |
| 78 case PROFILE_ENTERPRISE_ENROLLMENT_CERTIFICATE: | 81 case PROFILE_ENTERPRISE_ENROLLMENT_CERTIFICATE: |
| 79 return kEnterpriseMachineKey; | 82 return kEnterpriseMachineKey; |
| 80 case PROFILE_ENTERPRISE_USER_CERTIFICATE: | 83 case PROFILE_ENTERPRISE_USER_CERTIFICATE: |
| 81 return kEnterpriseUserKey; | 84 return kEnterpriseUserKey; |
| 82 case PROFILE_CONTENT_PROTECTION_CERTIFICATE: | 85 case PROFILE_CONTENT_PROTECTION_CERTIFICATE: |
| 83 return std::string(kContentProtectionKeyPrefix) + origin; | 86 return std::string(kContentProtectionKeyPrefix) + request_origin; |
| 84 } | 87 } |
| 85 NOTREACHED(); | 88 NOTREACHED(); |
| 86 return ""; | 89 return ""; |
| 87 } | 90 } |
| 88 | 91 |
| 89 } // namespace | |
| 90 | |
| 91 AttestationFlow::AttestationFlow(cryptohome::AsyncMethodCaller* async_caller, | 92 AttestationFlow::AttestationFlow(cryptohome::AsyncMethodCaller* async_caller, |
| 92 CryptohomeClient* cryptohome_client, | 93 CryptohomeClient* cryptohome_client, |
| 93 std::unique_ptr<ServerProxy> server_proxy) | 94 std::unique_ptr<ServerProxy> server_proxy) |
| 94 : async_caller_(async_caller), | 95 : async_caller_(async_caller), |
| 95 cryptohome_client_(cryptohome_client), | 96 cryptohome_client_(cryptohome_client), |
| 96 server_proxy_(std::move(server_proxy)), | 97 server_proxy_(std::move(server_proxy)), |
| 97 weak_factory_(this) {} | 98 weak_factory_(this) {} |
| 98 | 99 |
| 99 AttestationFlow::~AttestationFlow() { | 100 AttestationFlow::~AttestationFlow() { |
| 100 } | 101 } |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 } | 278 } |
| 278 | 279 |
| 279 ServerProxy::~ServerProxy() {} | 280 ServerProxy::~ServerProxy() {} |
| 280 | 281 |
| 281 PrivacyCAType ServerProxy::GetType() { | 282 PrivacyCAType ServerProxy::GetType() { |
| 282 return DEFAULT_PCA; | 283 return DEFAULT_PCA; |
| 283 } | 284 } |
| 284 | 285 |
| 285 } // namespace attestation | 286 } // namespace attestation |
| 286 } // namespace chromeos | 287 } // namespace chromeos |
| OLD | NEW |