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

Unified Diff: chrome/browser/devtools/adb/android_rsa.cc

Issue 18137007: DevTools: add about:flag for ADB-less remote debugging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For landing Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/devtools/adb/android_rsa.h ('k') | chrome/browser/devtools/adb/android_usb_device.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/adb/android_rsa.cc
diff --git a/chrome/browser/devtools/adb/android_rsa.cc b/chrome/browser/devtools/adb/android_rsa.cc
index 453091448692d1345a4d4e6a052addb7f95679bf..5333632cff06cffbbe1b0a7ce36cdaa42545a063 100644
--- a/chrome/browser/devtools/adb/android_rsa.cc
+++ b/chrome/browser/devtools/adb/android_rsa.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -196,7 +196,9 @@ void BnDiv(uint32* a, uint32* b, uint32** pq, uint32** pr) {
BnFree(ca);
}
-crypto::RSAPrivateKey* GetOrCreatePrivateKey(Profile* profile) {
+} // namespace
+
+crypto::RSAPrivateKey* AndroidRSAPrivateKey(Profile* profile) {
std::string encoded_key =
profile->GetPrefs()->GetString(prefs::kDevToolsAdbKey);
std::string decoded_key;
@@ -220,14 +222,11 @@ crypto::RSAPrivateKey* GetOrCreatePrivateKey(Profile* profile) {
return key.release();
}
-} // namespace
-
-std::string AndroidRSAPublicKey(Profile* profile) {
- scoped_ptr<crypto::RSAPrivateKey> key(GetOrCreatePrivateKey(profile));
+std::string AndroidRSAPublicKey(crypto::RSAPrivateKey* key) {
+ std::vector<uint8> public_key;
if (!key)
return kDummyRSAPublicKey;
- std::vector<uint8> public_key;
key->ExportPublicKey(&public_key);
std::string asn1(public_key.begin(), public_key.end());
@@ -278,14 +277,11 @@ std::string AndroidRSAPublicKey(Profile* profile) {
return output;
}
-std::string AndroidRSASign(Profile* profile, const std::string& body) {
- scoped_ptr<crypto::RSAPrivateKey> key(GetOrCreatePrivateKey(profile));
- if (!key)
- return std::string();
-
+std::string AndroidRSASign(crypto::RSAPrivateKey* key,
+ const std::string& body) {
std::vector<uint8> digest(body.begin(), body.end());
std::vector<uint8> result;
- if (!crypto::SignatureCreator::Sign(key.get(), vector_as_array(&digest),
+ if (!crypto::SignatureCreator::Sign(key, vector_as_array(&digest),
digest.size(), &result)) {
return std::string();
}
« no previous file with comments | « chrome/browser/devtools/adb/android_rsa.h ('k') | chrome/browser/devtools/adb/android_usb_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698