| 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 "components/ownership/owner_settings_service.h" | 5 #include "components/ownership/owner_settings_service.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 crypto::RSAPrivateKey* private_key) { | 25 crypto::RSAPrivateKey* private_key) { |
| 26 // Assemble the policy. | 26 // Assemble the policy. |
| 27 em::PolicyFetchResponse policy_response; | 27 em::PolicyFetchResponse policy_response; |
| 28 if (!policy->SerializeToString(policy_response.mutable_policy_data())) { | 28 if (!policy->SerializeToString(policy_response.mutable_policy_data())) { |
| 29 LOG(ERROR) << "Failed to encode policy payload."; | 29 LOG(ERROR) << "Failed to encode policy payload."; |
| 30 return std::string(); | 30 return std::string(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 // Generate the signature. | 33 // Generate the signature. |
| 34 scoped_ptr<crypto::SignatureCreator> signature_creator( | 34 scoped_ptr<crypto::SignatureCreator> signature_creator( |
| 35 crypto::SignatureCreator::Create(private_key)); | 35 crypto::SignatureCreator::Create(private_key, |
| 36 crypto::SignatureCreator::SHA1)); |
| 36 signature_creator->Update( | 37 signature_creator->Update( |
| 37 reinterpret_cast<const uint8*>(policy_response.policy_data().c_str()), | 38 reinterpret_cast<const uint8*>(policy_response.policy_data().c_str()), |
| 38 policy_response.policy_data().size()); | 39 policy_response.policy_data().size()); |
| 39 std::vector<uint8> signature_bytes; | 40 std::vector<uint8> signature_bytes; |
| 40 std::string policy_blob; | 41 std::string policy_blob; |
| 41 if (!signature_creator->Final(&signature_bytes)) { | 42 if (!signature_creator->Final(&signature_bytes)) { |
| 42 LOG(ERROR) << "Failed to create policy signature."; | 43 LOG(ERROR) << "Failed to create policy signature."; |
| 43 return std::string(); | 44 return std::string(); |
| 44 } | 45 } |
| 45 | 46 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 for (std::vector<IsOwnerCallback>::iterator it(is_owner_callbacks.begin()); | 110 for (std::vector<IsOwnerCallback>::iterator it(is_owner_callbacks.begin()); |
| 110 it != is_owner_callbacks.end(); | 111 it != is_owner_callbacks.end(); |
| 111 ++it) { | 112 ++it) { |
| 112 it->Run(is_owner); | 113 it->Run(is_owner); |
| 113 } | 114 } |
| 114 | 115 |
| 115 OnPostKeypairLoadedActions(); | 116 OnPostKeypairLoadedActions(); |
| 116 } | 117 } |
| 117 | 118 |
| 118 } // namespace ownership | 119 } // namespace ownership |
| OLD | NEW |