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

Side by Side Diff: net/cert/multi_log_ct_verifier.h

Issue 1440643002: Certificate Transparency: Per-profile CT verification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made CTLogVerifier const throughout. Created 5 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef NET_CERT_MULTI_LOG_CT_VERIFIER_H_ 5 #ifndef NET_CERT_MULTI_LOG_CT_VERIFIER_H_
6 #define NET_CERT_MULTI_LOG_CT_VERIFIER_H_ 6 #define NET_CERT_MULTI_LOG_CT_VERIFIER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "net/base/net_export.h" 12 #include "net/base/net_export.h"
13 #include "net/cert/ct_verifier.h" 13 #include "net/cert/ct_verifier.h"
14 #include "net/cert/signed_certificate_timestamp.h" 14 #include "net/cert/signed_certificate_timestamp.h"
15 15
16 namespace net { 16 namespace net {
17 17
18 namespace ct { 18 namespace ct {
19 struct LogEntry; 19 struct LogEntry;
20 } // namespace ct 20 } // namespace ct
21 21
22 class CTLogVerifier; 22 class CTLogVerifier;
23 23
24 // A Certificate Transparency verifier that can verify Signed Certificate 24 // A Certificate Transparency verifier that can verify Signed Certificate
25 // Timestamps from multiple logs. 25 // Timestamps from multiple logs.
26 // There should be a global instance of this class and for all known logs, 26 // It must be initialized with a list of logs by calling AddLogs.
27 // AddLog should be called with a CTLogVerifier (which is created from the 27 // As the observer may store the observed SCTs and certificates, an instance
28 // log's public key). 28 // of this class must exist for each profile.
mmenke 2015/11/20 17:23:58 See other comment about layering violation.
Eran Messeri 2015/11/23 12:34:38 Removed this text. I'm not sure how to phrase it i
29 class NET_EXPORT MultiLogCTVerifier : public CTVerifier { 29 class NET_EXPORT MultiLogCTVerifier : public CTVerifier {
30 public: 30 public:
31 MultiLogCTVerifier(); 31 MultiLogCTVerifier();
32 ~MultiLogCTVerifier() override; 32 ~MultiLogCTVerifier() override;
33 33
34 void AddLogs(const std::vector<scoped_refptr<CTLogVerifier>>& log_verifiers); 34 void AddLogs(
35 const std::vector<scoped_refptr<const CTLogVerifier>>& log_verifiers);
35 36
36 // CTVerifier implementation: 37 // CTVerifier implementation:
37 int Verify(X509Certificate* cert, 38 int Verify(X509Certificate* cert,
38 const std::string& stapled_ocsp_response, 39 const std::string& stapled_ocsp_response,
39 const std::string& sct_list_from_tls_extension, 40 const std::string& sct_list_from_tls_extension,
40 ct::CTVerifyResult* result, 41 ct::CTVerifyResult* result,
41 const BoundNetLog& net_log) override; 42 const BoundNetLog& net_log) override;
42 43
43 void SetObserver(Observer* observer) override; 44 void SetObserver(Observer* observer) override;
44 45
45 private: 46 private:
46 // Verify a list of SCTs from |encoded_sct_list| over |expected_entry|, 47 // Verify a list of SCTs from |encoded_sct_list| over |expected_entry|,
47 // placing the verification results in |result|. The SCTs in the list 48 // placing the verification results in |result|. The SCTs in the list
48 // come from |origin| (as will be indicated in the origin field of each SCT). 49 // come from |origin| (as will be indicated in the origin field of each SCT).
49 bool VerifySCTs(const std::string& encoded_sct_list, 50 bool VerifySCTs(const std::string& encoded_sct_list,
50 const ct::LogEntry& expected_entry, 51 const ct::LogEntry& expected_entry,
51 ct::SignedCertificateTimestamp::Origin origin, 52 ct::SignedCertificateTimestamp::Origin origin,
52 X509Certificate* cert, 53 X509Certificate* cert,
53 ct::CTVerifyResult* result); 54 ct::CTVerifyResult* result);
54 55
55 // Verifies a single, parsed SCT against all logs. 56 // Verifies a single, parsed SCT against all logs.
56 bool VerifySingleSCT(scoped_refptr<ct::SignedCertificateTimestamp> sct, 57 bool VerifySingleSCT(scoped_refptr<ct::SignedCertificateTimestamp> sct,
57 const ct::LogEntry& expected_entry, 58 const ct::LogEntry& expected_entry,
58 X509Certificate* cert, 59 X509Certificate* cert,
59 ct::CTVerifyResult* result); 60 ct::CTVerifyResult* result);
60 61
61 // Mapping from a log's ID to the verifier for this log. 62 // Mapping from a log's ID to the verifier for this log.
62 // A log's ID is the SHA-256 of the log's key, as defined in section 3.2. 63 // A log's ID is the SHA-256 of the log's key, as defined in section 3.2.
63 // of RFC6962. 64 // of RFC6962.
64 std::map<std::string, scoped_refptr<CTLogVerifier>> logs_; 65 std::map<std::string, scoped_refptr<const CTLogVerifier>> logs_;
65 66
66 Observer* observer_; 67 Observer* observer_;
67 68
68 DISALLOW_COPY_AND_ASSIGN(MultiLogCTVerifier); 69 DISALLOW_COPY_AND_ASSIGN(MultiLogCTVerifier);
69 }; 70 };
70 71
71 } // namespace net 72 } // namespace net
72 73
73 #endif // NET_CERT_MULTI_LOG_CT_VERIFIER_H_ 74 #endif // NET_CERT_MULTI_LOG_CT_VERIFIER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698