| 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 <set> |
| 10 #include <string> |
| 11 #include <vector> |
| 12 |
| 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "net/cert/ct_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 |
| 30 // Tracks the state of the Merkle Trees of CT logs Chromium |
| 31 // knows about. For now, only stores Signed Tree Heads. |
| 32 class TreeStateTracker : public net::ct::CTObserver { |
| 33 public: |
| 34 explicit TreeStateTracker( |
| 35 const std::vector<scoped_refptr<const net::CTLogVerifier>>& ct_logs); |
| 36 ~TreeStateTracker() override; |
| 37 |
| 38 void OnSCTVerified(net::X509Certificate* cert, |
| 39 const net::ct::SignedCertificateTimestamp* sct) override; |
| 40 |
| 41 void NewSTHObserved(const net::ct::SignedTreeHead& sth) override; |
| 42 |
| 43 private: |
| 44 void LoadSTHs(); |
| 45 |
| 46 // Handling TreeStateStorage results |
| 47 void OnSTHLoaded(const net::ct::SignedTreeHead& sth); |
| 48 |
| 49 // Update the STH in the map and on disk. |
| 50 void UpdateVerifiedSTH(const std::string& log_id, |
| 51 const net::ct::SignedTreeHead& verified_sth); |
| 52 |
| 53 // Holds the latest STH fetched and verified for each log. |
| 54 std::map<std::string, net::ct::SignedTreeHead> verified_sths_; |
| 55 // List of CT logs to track. |
| 56 std::map<std::string, scoped_refptr<const net::CTLogVerifier>> ct_logs_; |
| 57 // List of SCTs for each log. |
| 58 /* |
| 59 std::map<std::string, std::set<scoped_refptr<ct::SignedCertificateTimestamp>>> |
| 60 pending_scts_; |
| 61 */ |
| 62 // Is load pending? |
| 63 bool initial_load_pending_; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(TreeStateTracker); |
| 66 }; |
| 67 |
| 68 } // namespace certificate_transparency |
| 69 |
| 70 #endif // COMPONENTS_CERTIFICATE_TRANSPARENCY_TREE_STATE_TRACKER_H_ |
| OLD | NEW |