Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_CERTIFICATE_TRANSPARENCY_TREE_STATE_TRACKER_H_ | |
| 6 #define COMPONENTS_CERTIFICATE_TRANSPARENCY_TREE_STATE_TRACKER_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <memory> | |
| 10 #include <string> | |
| 11 #include <vector> | |
| 12 | |
| 13 #include "base/memory/ref_counted.h" | |
| 14 #include "net/cert/ct_verifier.h" | |
| 15 #include "net/cert/sth_observer.h" | |
| 16 | |
| 17 namespace net { | |
| 18 class CTLogVerifier; | |
| 19 class X509Certificate; | |
| 20 | |
| 21 namespace ct { | |
| 22 struct SignedCertificateTimestamp; | |
| 23 struct SignedTreeHead; | |
| 24 } // namespace ct | |
| 25 | |
| 26 } // namespace net | |
| 27 | |
| 28 namespace certificate_transparency { | |
| 29 class SingleTreeTracker; | |
| 30 | |
| 31 // Starting point for handling observed Certificate Transparency data in | |
| 32 // a particular browsing session. | |
| 33 // This class receives notifications of new Signed Tree Heads (STHs) and | |
| 34 // verified Signed Certificate Timestamps (SCTs) and delegates them to | |
| 35 // the SingleTreeTracker tracking the CT log they relate to. | |
| 36 // TODO(eranm): Export the inclusion check status of SCTs+Certs so it can | |
| 37 // be used in the DevTools Security panel, for example - crbug.com/506227 | |
| 38 class TreeStateTracker : public net::CTVerifier::Observer, | |
| 39 public net::ct::STHObserver { | |
| 40 public: | |
| 41 // Track the set of logs provided in |ct_logs|. An instance of this class | |
| 42 // 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 // during the object's life time. | |
| 45 // Observed STHs from logs not in this list will be simply ignored. | |
| 46 // As the assumption is that all recognized logs are known during creation | |
| 47 // time, there's a CHECK in OnSCTVerified that the verified SCT is from | |
| 48 // one of the logs in the list provided during construction. | |
|
Ryan Sleevi
2016/05/18 16:58:19
Better, but not quite - now that's documenting the
Eran Messeri
2016/05/19 12:35:00
I understand the asymmetry problem of CHECK-failin
Ryan Sleevi
2016/05/19 17:20:56
That's one approach, but the other I think makes i
| |
| 49 explicit TreeStateTracker( | |
| 50 std::vector<scoped_refptr<const net::CTLogVerifier>> ct_logs); | |
| 51 ~TreeStateTracker() override; | |
| 52 | |
| 53 // net::ct::CTVerifier::Observer implementation. | |
| 54 // Delegates to the tree tracker corresponding to the log that issued the SCT. | |
| 55 // Must only be called with SCTs from logs present during construction. | |
|
Ryan Sleevi
2016/05/18 16:58:19
Happy to drop 55/61 in light of the ctor comment.
Eran Messeri
2016/05/19 12:35:00
Done.
| |
| 56 void OnSCTVerified(net::X509Certificate* cert, | |
| 57 const net::ct::SignedCertificateTimestamp* sct) override; | |
| 58 | |
| 59 // net::ct::STHObserver implementation. | |
| 60 // Delegates to the tree tracker corresponding to the log that issued the STH. | |
| 61 // Does nothing if the STH is from a log not present during construction. | |
| 62 void NewSTHObserved(const net::ct::SignedTreeHead& sth) override; | |
| 63 | |
| 64 private: | |
| 65 // Holds the SingleTreeTracker for each log | |
| 66 std::map<std::string, std::unique_ptr<SingleTreeTracker>> tree_trackers_; | |
| 67 | |
| 68 DISALLOW_COPY_AND_ASSIGN(TreeStateTracker); | |
| 69 }; | |
| 70 | |
| 71 } // namespace certificate_transparency | |
| 72 | |
| 73 #endif // COMPONENTS_CERTIFICATE_TRANSPARENCY_TREE_STATE_TRACKER_H_ | |
| OLD | NEW |