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

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: iOS fix Created 4 years, 6 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/callback_helpers.h" 12 #include "base/callback_helpers.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/format_macros.h" 15 #include "base/format_macros.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/metrics/field_trial.h" 18 #include "base/metrics/field_trial.h"
19 #include "base/metrics/histogram.h" 19 #include "base/metrics/histogram.h"
20 #include "base/metrics/sparse_histogram.h" 20 #include "base/metrics/sparse_histogram.h"
21 #include "base/rand_util.h" 21 #include "base/rand_util.h"
22 #include "base/sequenced_task_runner_helpers.h" 22 #include "base/sequenced_task_runner_helpers.h"
23 #include "base/sha1.h"
23 #include "base/stl_util.h" 24 #include "base/stl_util.h"
24 #include "base/strings/string_number_conversions.h" 25 #include "base/strings/string_number_conversions.h"
25 #include "base/strings/string_split.h" 26 #include "base/strings/string_split.h"
26 #include "base/strings/string_util.h" 27 #include "base/strings/string_util.h"
27 #include "base/strings/stringprintf.h" 28 #include "base/strings/stringprintf.h"
28 #include "base/task/cancelable_task_tracker.h" 29 #include "base/task/cancelable_task_tracker.h"
29 #include "base/threading/sequenced_worker_pool.h" 30 #include "base/threading/sequenced_worker_pool.h"
30 #include "base/time/time.h" 31 #include "base/time/time.h"
31 #include "build/build_config.h" 32 #include "build/build_config.h"
32 #include "chrome/browser/browser_process.h" 33 #include "chrome/browser/browser_process.h"
(...skipping 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 for (size_t j = 0; j < ou_tokens.size(); ++j) { 1664 for (size_t j = 0; j < ou_tokens.size(); ++j) {
1664 paths_to_check.insert(cn_token + o_tokens[i] + ou_tokens[j]); 1665 paths_to_check.insert(cn_token + o_tokens[i] + ou_tokens[j]);
1665 paths_to_check.insert(o_tokens[i] + ou_tokens[j]); 1666 paths_to_check.insert(o_tokens[i] + ou_tokens[j]);
1666 } 1667 }
1667 } 1668 }
1668 for (size_t i = 0; i < ou_tokens.size(); ++i) { 1669 for (size_t i = 0; i < ou_tokens.size(); ++i) {
1669 paths_to_check.insert(cn_token + ou_tokens[i]); 1670 paths_to_check.insert(cn_token + ou_tokens[i]);
1670 paths_to_check.insert(ou_tokens[i]); 1671 paths_to_check.insert(ou_tokens[i]);
1671 } 1672 }
1672 1673
1673 std::string issuer_fp = base::HexEncode(issuer.fingerprint().data, 1674 std::string issuer_der;
1674 sizeof(issuer.fingerprint().data)); 1675 net::X509Certificate::GetDEREncoded(issuer.os_cert_handle(), &issuer_der);
Nathan Parker 2016/06/16 18:32:23 Can you verify this produces the same string as be
Ryan Sleevi 2016/06/16 21:16:45 Confirmed.
1676 std::string hashed = base::SHA1HashString(issuer_der);
1677 std::string issuer_fp = base::HexEncode(hashed.data(), hashed.size());
1675 for (std::set<std::string>::iterator it = paths_to_check.begin(); 1678 for (std::set<std::string>::iterator it = paths_to_check.begin();
1676 it != paths_to_check.end(); ++it) { 1679 it != paths_to_check.end(); ++it) {
1677 whitelist_strings->push_back("cert/" + issuer_fp + *it); 1680 whitelist_strings->push_back("cert/" + issuer_fp + *it);
1678 } 1681 }
1679 } 1682 }
1680 1683
1681 // static 1684 // static
1682 GURL DownloadProtectionService::GetDownloadRequestUrl() { 1685 GURL DownloadProtectionService::GetDownloadRequestUrl() {
1683 GURL url(kDownloadRequestUrl); 1686 GURL url(kDownloadRequestUrl);
1684 std::string api_key = google_apis::GetAPIKey(); 1687 std::string api_key = google_apis::GetAPIKey();
1685 if (!api_key.empty()) 1688 if (!api_key.empty())
1686 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true)); 1689 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true));
1687 1690
1688 return url; 1691 return url;
1689 } 1692 }
1690 1693
1691 } // namespace safe_browsing 1694 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698