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

Unified Diff: components/certificate_transparency/tree_state_tracker.h

Issue 1845113003: Certificate Transparency: Start tracking logs' state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months 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 side-by-side diff with in-line comments
Download patch
Index: components/certificate_transparency/tree_state_tracker.h
diff --git a/components/certificate_transparency/tree_state_tracker.h b/components/certificate_transparency/tree_state_tracker.h
new file mode 100644
index 0000000000000000000000000000000000000000..de682541bff6f33a0eaa9b9348bdf200730add2a
--- /dev/null
+++ b/components/certificate_transparency/tree_state_tracker.h
@@ -0,0 +1,70 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_CERTIFICATE_TRANSPARENCY_TREE_STATE_TRACKER_H_
+#define COMPONENTS_CERTIFICATE_TRANSPARENCY_TREE_STATE_TRACKER_H_
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "net/cert/ct_observer.h"
+
+namespace net {
+class CTLogVerifier;
+class X509Certificate;
+
+namespace ct {
+struct SignedCertificateTimestamp;
+struct SignedTreeHead;
+} // namespace ct
+
+} // namespace net
+
+namespace certificate_transparency {
+
+// Tracks the state of the Merkle Trees of CT logs Chromium
+// knows about. For now, only stores Signed Tree Heads.
+class TreeStateTracker : public net::ct::CTObserver {
+ public:
+ explicit TreeStateTracker(
+ const std::vector<scoped_refptr<const net::CTLogVerifier>>& ct_logs);
+ ~TreeStateTracker() override;
+
+ void OnSCTVerified(net::X509Certificate* cert,
+ const net::ct::SignedCertificateTimestamp* sct) override;
+
+ void NewSTHObserved(const net::ct::SignedTreeHead& sth) override;
+
+ private:
+ void LoadSTHs();
+
+ // Handling TreeStateStorage results
+ void OnSTHLoaded(const net::ct::SignedTreeHead& sth);
+
+ // Update the STH in the map and on disk.
+ void UpdateVerifiedSTH(const std::string& log_id,
+ const net::ct::SignedTreeHead& verified_sth);
+
+ // Holds the latest STH fetched and verified for each log.
+ std::map<std::string, net::ct::SignedTreeHead> verified_sths_;
+ // List of CT logs to track.
+ std::map<std::string, scoped_refptr<const net::CTLogVerifier>> ct_logs_;
+ // List of SCTs for each log.
+ /*
+ std::map<std::string, std::set<scoped_refptr<ct::SignedCertificateTimestamp>>>
+ pending_scts_;
+ */
+ // Is load pending?
+ bool initial_load_pending_;
+
+ DISALLOW_COPY_AND_ASSIGN(TreeStateTracker);
+};
+
+} // namespace certificate_transparency
+
+#endif // COMPONENTS_CERTIFICATE_TRANSPARENCY_TREE_STATE_TRACKER_H_
« no previous file with comments | « components/certificate_transparency/OWNERS ('k') | components/certificate_transparency/tree_state_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698