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

Side by Side Diff: chrome/browser/safe_browsing/download_protection_service.cc

Issue 2000503002: Remove the fingerprint and ca_fingerprint from X509Certificate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_cache
Patch Set: Created 4 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/safe_browsing/download_protection_service.h" 5 #include "chrome/browser/safe_browsing/download_protection_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/format_macros.h" 14 #include "base/format_macros.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/metrics/field_trial.h" 17 #include "base/metrics/field_trial.h"
18 #include "base/metrics/histogram.h" 18 #include "base/metrics/histogram.h"
19 #include "base/metrics/sparse_histogram.h" 19 #include "base/metrics/sparse_histogram.h"
20 #include "base/rand_util.h" 20 #include "base/rand_util.h"
21 #include "base/sequenced_task_runner_helpers.h" 21 #include "base/sequenced_task_runner_helpers.h"
22 #include "base/sha1.h"
22 #include "base/stl_util.h" 23 #include "base/stl_util.h"
23 #include "base/strings/string_number_conversions.h" 24 #include "base/strings/string_number_conversions.h"
24 #include "base/strings/string_split.h" 25 #include "base/strings/string_split.h"
25 #include "base/strings/string_util.h" 26 #include "base/strings/string_util.h"
26 #include "base/strings/stringprintf.h" 27 #include "base/strings/stringprintf.h"
27 #include "base/task/cancelable_task_tracker.h" 28 #include "base/task/cancelable_task_tracker.h"
28 #include "base/threading/sequenced_worker_pool.h" 29 #include "base/threading/sequenced_worker_pool.h"
29 #include "base/time/time.h" 30 #include "base/time/time.h"
30 #include "build/build_config.h" 31 #include "build/build_config.h"
31 #include "chrome/browser/browser_process.h" 32 #include "chrome/browser/browser_process.h"
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 for (size_t j = 0; j < ou_tokens.size(); ++j) { 1317 for (size_t j = 0; j < ou_tokens.size(); ++j) {
1317 paths_to_check.insert(cn_token + o_tokens[i] + ou_tokens[j]); 1318 paths_to_check.insert(cn_token + o_tokens[i] + ou_tokens[j]);
1318 paths_to_check.insert(o_tokens[i] + ou_tokens[j]); 1319 paths_to_check.insert(o_tokens[i] + ou_tokens[j]);
1319 } 1320 }
1320 } 1321 }
1321 for (size_t i = 0; i < ou_tokens.size(); ++i) { 1322 for (size_t i = 0; i < ou_tokens.size(); ++i) {
1322 paths_to_check.insert(cn_token + ou_tokens[i]); 1323 paths_to_check.insert(cn_token + ou_tokens[i]);
1323 paths_to_check.insert(ou_tokens[i]); 1324 paths_to_check.insert(ou_tokens[i]);
1324 } 1325 }
1325 1326
1326 std::string issuer_fp = base::HexEncode(issuer.fingerprint().data, 1327 std::string issuer_der;
1327 sizeof(issuer.fingerprint().data)); 1328 net::X509Certificate::GetDEREncoded(issuer.os_cert_handle(), &issuer_der);
1329 std::string hashed = base::SHA1HashString(issuer_der);
1330 std::string issuer_fp = base::HexEncode(hashed.data(), hashed.size());
1328 for (std::set<std::string>::iterator it = paths_to_check.begin(); 1331 for (std::set<std::string>::iterator it = paths_to_check.begin();
1329 it != paths_to_check.end(); ++it) { 1332 it != paths_to_check.end(); ++it) {
1330 whitelist_strings->push_back("cert/" + issuer_fp + *it); 1333 whitelist_strings->push_back("cert/" + issuer_fp + *it);
1331 } 1334 }
1332 } 1335 }
1333 1336
1334 // static 1337 // static
1335 GURL DownloadProtectionService::GetDownloadRequestUrl() { 1338 GURL DownloadProtectionService::GetDownloadRequestUrl() {
1336 GURL url(kDownloadRequestUrl); 1339 GURL url(kDownloadRequestUrl);
1337 std::string api_key = google_apis::GetAPIKey(); 1340 std::string api_key = google_apis::GetAPIKey();
1338 if (!api_key.empty()) 1341 if (!api_key.empty())
1339 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true)); 1342 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true));
1340 1343
1341 return url; 1344 return url;
1342 } 1345 }
1343 1346
1344 } // namespace safe_browsing 1347 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698