Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_CERTIFICATE_TRANSPARENCY_TREE_STATE_TRACKER_H_ | 5 #ifndef COMPONENTS_CERTIFICATE_TRANSPARENCY_TREE_STATE_TRACKER_H_ |
| 6 #define COMPONENTS_CERTIFICATE_TRANSPARENCY_TREE_STATE_TRACKER_H_ | 6 #define COMPONENTS_CERTIFICATE_TRANSPARENCY_TREE_STATE_TRACKER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "net/cert/ct_verifier.h" | 14 #include "net/cert/ct_verifier.h" |
| 15 #include "net/cert/sth_observer.h" | 15 #include "net/cert/sth_observer.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 class NetLog; | |
| 18 class CTLogVerifier; | 19 class CTLogVerifier; |
| 19 class X509Certificate; | 20 class X509Certificate; |
| 20 | 21 |
| 21 namespace ct { | 22 namespace ct { |
| 22 struct SignedCertificateTimestamp; | 23 struct SignedCertificateTimestamp; |
| 23 struct SignedTreeHead; | 24 struct SignedTreeHead; |
| 24 } // namespace ct | 25 } // namespace ct |
| 25 | 26 |
| 26 } // namespace net | 27 } // namespace net |
| 27 | 28 |
| 28 namespace certificate_transparency { | 29 namespace certificate_transparency { |
| 29 class LogDnsClient; | 30 class LogDnsClient; |
| 30 class SingleTreeTracker; | 31 class SingleTreeTracker; |
| 31 | 32 |
| 32 // This class receives notifications of new Signed Tree Heads (STHs) and | 33 // This class receives notifications of new Signed Tree Heads (STHs) and |
| 33 // verified Signed Certificate Timestamps (SCTs) and delegates them to | 34 // verified Signed Certificate Timestamps (SCTs) and delegates them to |
| 34 // the SingleTreeTracker tracking the CT log they relate to. | 35 // the SingleTreeTracker tracking the CT log they relate to. |
| 35 // TODO(eranm): Export the inclusion check status of SCTs+Certs so it can | 36 // TODO(eranm): Export the inclusion check status of SCTs+Certs so it can |
| 36 // be used in the DevTools Security panel, for example. See | 37 // be used in the DevTools Security panel, for example. See |
| 37 // https://crbug.com/506227#c22. | 38 // https://crbug.com/506227#c22. |
| 38 class TreeStateTracker : public net::CTVerifier::Observer, | 39 class TreeStateTracker : public net::CTVerifier::Observer, |
| 39 public net::ct::STHObserver { | 40 public net::ct::STHObserver { |
| 40 public: | 41 public: |
| 41 // Tracks the state of the logs provided in |ct_logs|. An instance of this | 42 // Tracks the state of the logs provided in |ct_logs|. An instance of this |
| 42 // class only tracks the logs provided in the constructor. The implementation | 43 // class only tracks the logs provided in the constructor. The implementation |
| 43 // is based on the assumption that the list of recognized logs does not change | 44 // is based on the assumption that the list of recognized logs does not change |
| 44 // during the object's life time. | 45 // during the object's life time. |
| 45 // Observed STHs from logs not in this list will be simply ignored. | 46 // Observed STHs from logs not in this list will be simply ignored. |
| 46 explicit TreeStateTracker( | 47 TreeStateTracker( |
| 47 std::vector<scoped_refptr<const net::CTLogVerifier>> ct_logs); | 48 std::vector<scoped_refptr<const net::CTLogVerifier>> ct_logs, |
| 49 net::NetLog* raw_net_log); | |
|
eroman
2017/01/25 21:23:08
net_log
That matches the .cc file, and is the idi
Eran Messeri
2017/01/26 15:08:40
My bad, this was a left-over from a previous versi
| |
| 48 ~TreeStateTracker() override; | 50 ~TreeStateTracker() override; |
| 49 | 51 |
| 50 // net::ct::CTVerifier::Observer implementation. | 52 // net::ct::CTVerifier::Observer implementation. |
| 51 // Delegates to the tree tracker corresponding to the log that issued the SCT. | 53 // Delegates to the tree tracker corresponding to the log that issued the SCT. |
| 52 void OnSCTVerified(net::X509Certificate* cert, | 54 void OnSCTVerified(net::X509Certificate* cert, |
| 53 const net::ct::SignedCertificateTimestamp* sct) override; | 55 const net::ct::SignedCertificateTimestamp* sct) override; |
| 54 | 56 |
| 55 // net::ct::STHObserver implementation. | 57 // net::ct::STHObserver implementation. |
| 56 // Delegates to the tree tracker corresponding to the log that issued the STH. | 58 // Delegates to the tree tracker corresponding to the log that issued the STH. |
| 57 void NewSTHObserved(const net::ct::SignedTreeHead& sth) override; | 59 void NewSTHObserved(const net::ct::SignedTreeHead& sth) override; |
| 58 | 60 |
| 59 private: | 61 private: |
| 60 // A Log DNS client for fetching inclusion proof and leaf indices from | 62 // A Log DNS client for fetching inclusion proof and leaf indices from |
| 61 // DNS front-end of CT logs. | 63 // DNS front-end of CT logs. |
| 62 // Shared between all SingleTreeTrackers, for rate-limiting across all | 64 // Shared between all SingleTreeTrackers, for rate-limiting across all |
| 63 // trackers. Must be deleted after the tree trackers. | 65 // trackers. Must be deleted after the tree trackers. |
| 64 std::unique_ptr<LogDnsClient> dns_client_; | 66 std::unique_ptr<LogDnsClient> dns_client_; |
| 65 | 67 |
| 66 // Holds the SingleTreeTracker for each log | 68 // Holds the SingleTreeTracker for each log |
| 67 std::map<std::string, std::unique_ptr<SingleTreeTracker>> tree_trackers_; | 69 std::map<std::string, std::unique_ptr<SingleTreeTracker>> tree_trackers_; |
| 68 | 70 |
| 69 DISALLOW_COPY_AND_ASSIGN(TreeStateTracker); | 71 DISALLOW_COPY_AND_ASSIGN(TreeStateTracker); |
| 70 }; | 72 }; |
| 71 | 73 |
| 72 } // namespace certificate_transparency | 74 } // namespace certificate_transparency |
| 73 | 75 |
| 74 #endif // COMPONENTS_CERTIFICATE_TRANSPARENCY_TREE_STATE_TRACKER_H_ | 76 #endif // COMPONENTS_CERTIFICATE_TRANSPARENCY_TREE_STATE_TRACKER_H_ |
| OLD | NEW |