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

Side by Side Diff: chrome/browser/devtools/device/usb/android_rsa.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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_creator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/devtools/device/usb/android_rsa.h" 5 #include "chrome/browser/devtools/device/usb/android_rsa.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/prefs/pref_service_syncable.h" 9 #include "chrome/browser/prefs/pref_service_syncable.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 std::string output; 255 std::string output;
256 std::string input(reinterpret_cast<char*>(&pkey), sizeof(pkey)); 256 std::string input(reinterpret_cast<char*>(&pkey), sizeof(pkey));
257 base::Base64Encode(input, &output); 257 base::Base64Encode(input, &output);
258 return output; 258 return output;
259 } 259 }
260 260
261 std::string AndroidRSASign(crypto::RSAPrivateKey* key, 261 std::string AndroidRSASign(crypto::RSAPrivateKey* key,
262 const std::string& body) { 262 const std::string& body) {
263 std::vector<uint8> digest(body.begin(), body.end()); 263 std::vector<uint8> digest(body.begin(), body.end());
264 std::vector<uint8> result; 264 std::vector<uint8> result;
265 if (!crypto::SignatureCreator::Sign(key, vector_as_array(&digest), 265 if (!crypto::SignatureCreator::Sign(key, crypto::SignatureCreator::SHA1,
266 digest.size(), &result)) { 266 vector_as_array(&digest), digest.size(),
267 &result)) {
267 return std::string(); 268 return std::string();
268 } 269 }
269 return std::string(result.begin(), result.end()); 270 return std::string(result.begin(), result.end());
270 } 271 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_creator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698