Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: components/ownership/owner_settings_service.cc

Issue 560583002: Generalize crypto::SignatureCreator to allow choice of hash function, so as to support SHA256 (not … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase, fix some lint issues, and a shameful missing ")" Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_creator.cc ('k') | components/policy/core/common/cloud/policy_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698