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

Side by Side Diff: chrome/browser/ssl/ignore_errors_cert_verifier.h

Issue 2753123002: Add --ignore-certificate-errors-spki-list switch and UMA histogram. (Closed)
Patch Set: Move IgnoreErrorsCertVerifier to chrome/browser/ssl. Created 3 years, 8 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
(Empty)
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SSL_IGNORE_ERRORS_CERT_VERIFIER_H_
6 #define CHROME_BROWSER_SSL_IGNORE_ERRORS_CERT_VERIFIER_H_
7
8 #include <memory>
9 #include <string>
10 #include <vector>
11
12 #include "base/containers/flat_set.h"
13 #include "net/cert/cert_verifier.h"
14
15 namespace net {
16 class CertVerifyResult;
17 class CRLSet;
18 class NetLogWithSource;
Ryan Sleevi 2017/04/12 21:53:17 For 16/17/18, you don't need to forward declare, s
martinkr 2017/04/24 23:54:25 Done.
19 struct SHA256HashValue;
20 class SHA256HashValueLessThan;
21 } // namespace net
22
23 // IgnoreErrorsCertVerifier wraps another CertVerifier in order to ignore
24 // verification errors from certificate chains that match a whitelist of SPKI
25 // fingerprints.
26 class NET_EXPORT IgnoreErrorsCertVerifier : public net::CertVerifier {
27 public:
28 // SPKIHashSet is a set of SHA-256 SPKI fingerprints (RFC 7469, Section 2.4).
29 using SPKIHashSet =
30 base::flat_set<net::SHA256HashValue, net::SHA256HashValueLessThan>;
31
32 // MakeWhitelist converts a vector of Base64-encoded SHA-256 SPKI fingerprints
33 // into an SPKIHashSet. Invalid fingerprints are logged and skipped.
34 static SPKIHashSet MakeWhitelist(
35 const std::vector<std::string>& fingerprints);
36
37 IgnoreErrorsCertVerifier(std::unique_ptr<net::CertVerifier> verifier,
38 SPKIHashSet whitelist);
39
40 ~IgnoreErrorsCertVerifier() override;
41
42 // Verify invokes Verify() on the wrapped CertVerifier. If any of the
43 // certificates from the chain in |params| match one of the SPKI fingerprints
44 // from the whitelist, it returns OK regardless of the actual verification
45 // result (or ERR_IO_PENDING on asynchronous completion). Otherwise the actual
46 // result is returned.
47 int Verify(const RequestParams& params,
48 net::CRLSet* crl_set,
49 net::CertVerifyResult* verify_result,
50 const net::CompletionCallback& callback,
51 std::unique_ptr<Request>* out_req,
52 const net::NetLogWithSource& net_log) override;
53
54 private:
55 std::unique_ptr<net::CertVerifier> verifier_;
56 SPKIHashSet whitelist_;
57 };
58
59 #endif // CHROME_BROWSER_SSL_IGNORE_ERRORS_CERT_VERIFIER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698