Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/ownership/owner_settings_service.h" | 5 #include "chrome/browser/chromeos/ownership/owner_settings_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 crypto::RSAPrivateKey* private_key) { | 87 crypto::RSAPrivateKey* private_key) { |
| 88 // Assemble the policy. | 88 // Assemble the policy. |
| 89 em::PolicyFetchResponse policy_response; | 89 em::PolicyFetchResponse policy_response; |
| 90 if (!policy->SerializeToString(policy_response.mutable_policy_data())) { | 90 if (!policy->SerializeToString(policy_response.mutable_policy_data())) { |
| 91 LOG(ERROR) << "Failed to encode policy payload."; | 91 LOG(ERROR) << "Failed to encode policy payload."; |
| 92 return std::string(); | 92 return std::string(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 // Generate the signature. | 95 // Generate the signature. |
| 96 scoped_ptr<crypto::SignatureCreator> signature_creator( | 96 scoped_ptr<crypto::SignatureCreator> signature_creator( |
| 97 crypto::SignatureCreator::Create(private_key)); | 97 crypto::SignatureCreator::Create(private_key, |
| 98 crypto::SignatureCreator::SHA1); | |
|
dougsteed
2014/09/18 18:04:40
Noticed the missing ")" myself. Will be fixed in n
| |
| 98 signature_creator->Update( | 99 signature_creator->Update( |
| 99 reinterpret_cast<const uint8*>(policy_response.policy_data().c_str()), | 100 reinterpret_cast<const uint8*>(policy_response.policy_data().c_str()), |
| 100 policy_response.policy_data().size()); | 101 policy_response.policy_data().size()); |
| 101 std::vector<uint8> signature_bytes; | 102 std::vector<uint8> signature_bytes; |
| 102 std::string policy_blob; | 103 std::string policy_blob; |
| 103 if (!signature_creator->Final(&signature_bytes)) { | 104 if (!signature_creator->Final(&signature_bytes)) { |
| 104 LOG(ERROR) << "Failed to create policy signature."; | 105 LOG(ERROR) << "Failed to create policy signature."; |
| 105 return std::string(); | 106 return std::string(); |
| 106 } | 107 } |
| 107 | 108 |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 509 DeviceSettingsService* OwnerSettingsService::GetDeviceSettingsService() { | 510 DeviceSettingsService* OwnerSettingsService::GetDeviceSettingsService() { |
| 510 DCHECK(thread_checker_.CalledOnValidThread()); | 511 DCHECK(thread_checker_.CalledOnValidThread()); |
| 511 if (g_device_settings_service_for_testing) | 512 if (g_device_settings_service_for_testing) |
| 512 return g_device_settings_service_for_testing; | 513 return g_device_settings_service_for_testing; |
| 513 if (DeviceSettingsService::IsInitialized()) | 514 if (DeviceSettingsService::IsInitialized()) |
| 514 return DeviceSettingsService::Get(); | 515 return DeviceSettingsService::Get(); |
| 515 return NULL; | 516 return NULL; |
| 516 } | 517 } |
| 517 | 518 |
| 518 } // namespace chromeos | 519 } // namespace chromeos |
| OLD | NEW |