Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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 <string> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/memory/linked_ptr.h" | |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "net/cert/ct_verifier.h" | |
| 15 | |
| 16 namespace net { | |
| 17 class CTLogVerifier; | |
| 18 | |
| 19 namespace ct { | |
| 20 struct SignedCertificateTimestamp; | |
| 21 struct SignedTreeHead; | |
| 22 } // namespace ct | |
| 23 | |
| 24 } // namespace net | |
| 25 | |
| 26 namespace certificate_transparency { | |
| 27 | |
| 28 class LogProofFetcher; | |
| 29 | |
| 30 // Tracks the state of the Merkle Trees of CT logs Chromium | |
| 31 // knows about. For now, only stores Signed Tree Heads. | |
|
Ryan Sleevi
2015/06/29 11:58:13
Comment nit: "For now" suggests there may be more,
| |
| 32 class TreeStateTracker : public net::CTVerifier::Observer { | |
| 33 public: | |
| 34 TreeStateTracker(scoped_ptr<LogProofFetcher> fetcher, | |
| 35 const std::vector<linked_ptr<net::CTLogVerifier>>& ct_logs); | |
| 36 ~TreeStateTracker() override; | |
| 37 | |
| 38 void OnSCTVerified(const net::ct::SignedCertificateTimestamp* sct, | |
| 39 net::CTLogVerifier* verifier) override; | |
| 40 | |
| 41 private: | |
| 42 void RefreshSTHs(); | |
| 43 void OnSTHFetched(const std::string& log_id, | |
| 44 const net::ct::SignedTreeHead& unverified_sth); | |
| 45 | |
| 46 // Holds the latest STH fetched and verified for each log. | |
| 47 std::map<std::string, net::ct::SignedTreeHead> sths_; | |
| 48 // Fetcher for getting STHs and proofs from CT logs. | |
| 49 scoped_ptr<LogProofFetcher> fetcher_; | |
| 50 // List of CT logs to track. | |
| 51 std::map<std::string, linked_ptr<net::CTLogVerifier>> ct_logs_; | |
| 52 | |
| 53 DISALLOW_COPY_AND_ASSIGN(TreeStateTracker); | |
| 54 }; | |
| 55 | |
| 56 } // namespace certificate_transparency | |
| 57 | |
| 58 #endif // COMPONENTS_CERTIFICATE_TRANSPARENCY_TREE_STATE_TRACKER_H_ | |
| OLD | NEW |