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 #include "components/certificate_transparency/tree_state_tracker.h" | |
| 6 | |
| 7 #include "components/certificate_transparency/single_tree_tracker.h" | |
| 8 #include "net/cert/ct_log_verifier.h" | |
| 9 #include "net/cert/signed_certificate_timestamp.h" | |
| 10 #include "net/cert/signed_tree_head.h" | |
| 11 #include "net/cert/x509_certificate.h" | |
| 12 | |
| 13 using net::X509Certificate; | |
| 14 using net::CTLogVerifier; | |
| 15 using net::ct::SignedCertificateTimestamp; | |
| 16 using net::ct::SignedTreeHead; | |
| 17 | |
| 18 namespace certificate_transparency { | |
| 19 | |
| 20 TreeStateTracker::TreeStateTracker( | |
| 21 const std::vector<scoped_refptr<const CTLogVerifier>>& ct_logs) { | |
| 22 for (auto it = ct_logs.begin(); it != ct_logs.end(); ++it) { | |
|
Ryan Sleevi
2016/04/14 16:56:16
Use a range iterator
for (const auto& log : ct_lo
Eran Messeri
2016/04/18 22:02:12
Done.
| |
| 23 scoped_refptr<const CTLogVerifier> log(*it); | |
| 24 tree_trackers_[log->key_id()].reset(new SingleTreeTracker(log)); | |
| 25 } | |
| 26 } | |
| 27 | |
| 28 TreeStateTracker::~TreeStateTracker() {} | |
| 29 | |
| 30 void TreeStateTracker::OnSCTVerified(X509Certificate* cert, | |
| 31 const SignedCertificateTimestamp* sct) { | |
| 32 auto it = tree_trackers_.find(sct->log_id); | |
| 33 // Is the SCT from a known log? | |
| 34 if (it == tree_trackers_.end()) | |
| 35 return; | |
| 36 | |
| 37 it->second->OnSCTVerified(cert, sct); | |
| 38 } | |
| 39 | |
| 40 void TreeStateTracker::NewSTHObserved(const SignedTreeHead& sth) { | |
| 41 auto it = tree_trackers_.find(sth.log_id); | |
| 42 // Is the STH from a known log? | |
| 43 if (it == tree_trackers_.end()) | |
| 44 return; | |
| 45 | |
| 46 it->second->NewSTHObserved(sth); | |
| 47 } | |
| 48 | |
| 49 } // namespace certificate_transparency | |
| OLD | NEW |