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

Side by Side Diff: chrome/browser/chromeos/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: Remove unnecessary backwards compatibility and update call sites 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 "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
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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/devtools/device/usb/android_rsa.cc » ('j') | crypto/signature_creator_openssl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698