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 "chrome/browser/devtools/device/usb/android_rsa.h" | 5 #include "chrome/browser/devtools/device/usb/android_rsa.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
11 #include <limits> | 11 #include <limits> |
12 #include <memory> | 12 #include <memory> |
13 | 13 |
14 #include "base/base64.h" | 14 #include "base/base64.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
17 #include "components/syncable_prefs/pref_service_syncable.h" | 17 #include "components/sync_preferences/pref_service_syncable.h" |
18 #include "crypto/rsa_private_key.h" | 18 #include "crypto/rsa_private_key.h" |
19 #include "crypto/signature_creator.h" | 19 #include "crypto/signature_creator.h" |
20 #include "net/cert/asn1_util.h" | 20 #include "net/cert/asn1_util.h" |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 const size_t kRSANumWords = 64; | 24 const size_t kRSANumWords = 64; |
25 const size_t kBigIntSize = 1024; | 25 const size_t kBigIntSize = 1024; |
26 | 26 |
27 static const char kDummyRSAPublicKey[] = | 27 static const char kDummyRSAPublicKey[] = |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 std::string AndroidRSASign(crypto::RSAPrivateKey* key, | 271 std::string AndroidRSASign(crypto::RSAPrivateKey* key, |
272 const std::string& body) { | 272 const std::string& body) { |
273 std::vector<uint8_t> digest(body.begin(), body.end()); | 273 std::vector<uint8_t> digest(body.begin(), body.end()); |
274 std::vector<uint8_t> result; | 274 std::vector<uint8_t> result; |
275 if (!crypto::SignatureCreator::Sign(key, crypto::SignatureCreator::SHA1, | 275 if (!crypto::SignatureCreator::Sign(key, crypto::SignatureCreator::SHA1, |
276 digest.data(), digest.size(), &result)) { | 276 digest.data(), digest.size(), &result)) { |
277 return std::string(); | 277 return std::string(); |
278 } | 278 } |
279 return std::string(result.begin(), result.end()); | 279 return std::string(result.begin(), result.end()); |
280 } | 280 } |
OLD | NEW |