OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/cert/multi_log_ct_verifier.h" | 5 #include "net/cert/multi_log_ct_verifier.h" |
6 | 6 |
7 #include "net/base/net_errors.h" | 7 #include "net/base/net_errors.h" |
8 #include "net/cert/ct_log_verifier.h" | 8 #include "net/cert/ct_log_verifier.h" |
9 #include "net/cert/ct_objects_extractor.h" | 9 #include "net/cert/ct_objects_extractor.h" |
10 #include "net/cert/ct_serialization.h" | 10 #include "net/cert/ct_serialization.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 return verified; | 113 return verified; |
114 } | 114 } |
115 | 115 |
116 bool MultiLogCTVerifier::VerifySingleSCT( | 116 bool MultiLogCTVerifier::VerifySingleSCT( |
117 scoped_refptr<ct::SignedCertificateTimestamp> sct, | 117 scoped_refptr<ct::SignedCertificateTimestamp> sct, |
118 const ct::LogEntry& expected_entry, | 118 const ct::LogEntry& expected_entry, |
119 ct::CTVerifyResult* result) { | 119 ct::CTVerifyResult* result) { |
120 | 120 |
121 // Assume this SCT is untrusted until proven otherwise. | 121 // Assume this SCT is untrusted until proven otherwise. |
122 | |
123 IDToLogMap::iterator it = logs_.find(sct->log_id); | 122 IDToLogMap::iterator it = logs_.find(sct->log_id); |
124 if (it == logs_.end()) { | 123 if (it == logs_.end()) { |
125 DVLOG(1) << "SCT does not match any known log."; | 124 DVLOG(1) << "SCT does not match any known log."; |
126 result->unknown_logs_scts.push_back(sct); | 125 result->unknown_logs_scts.push_back(sct); |
127 return false; | 126 return false; |
128 } | 127 } |
129 | 128 |
130 if (!it->second->Verify(expected_entry, *sct)) { | 129 if (!it->second->Verify(expected_entry, *sct)) { |
131 DVLOG(1) << "Unable to verify SCT signature."; | 130 DVLOG(1) << "Unable to verify SCT signature."; |
132 result->unverified_scts.push_back(sct); | 131 result->unverified_scts.push_back(sct); |
133 return false; | 132 return false; |
134 } | 133 } |
135 | 134 |
136 // SCT verified ok, just make sure the timestamp is legitimate. | 135 // SCT verified ok, just make sure the timestamp is legitimate. |
137 if (sct->timestamp > base::Time::Now()) { | 136 if (sct->timestamp > base::Time::Now()) { |
138 DVLOG(1) << "SCT is from the future!"; | 137 DVLOG(1) << "SCT is from the future!"; |
139 result->unverified_scts.push_back(sct); | 138 result->unverified_scts.push_back(sct); |
140 return false; | 139 return false; |
141 } | 140 } |
142 | 141 |
143 result->verified_scts.push_back(sct); | 142 result->verified_scts.push_back(sct); |
144 return true; | 143 return true; |
145 } | 144 } |
146 | 145 |
147 } // namespace net | 146 } // namespace net |
OLD | NEW |