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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 IDToLogMap::iterator it = logs_.find(sct->log_id); | 206 IDToLogMap::iterator it = logs_.find(sct->log_id); |
207 if (it == logs_.end()) { | 207 if (it == logs_.end()) { |
208 DVLOG(1) << "SCT does not match any known log."; | 208 DVLOG(1) << "SCT does not match any known log."; |
209 result->unknown_logs_scts.push_back(sct); | 209 result->unknown_logs_scts.push_back(sct); |
210 LogSCTStatusToUMA(ct::SCT_STATUS_LOG_UNKNOWN); | 210 LogSCTStatusToUMA(ct::SCT_STATUS_LOG_UNKNOWN); |
211 return false; | 211 return false; |
212 } | 212 } |
213 | 213 |
214 sct->log_description = it->second->description(); | 214 sct->log_description = it->second->description(); |
215 | 215 |
216 if (!it->second->Verify(expected_entry, *sct)) { | 216 if (!it->second->Verify(expected_entry, *sct.get())) { |
217 DVLOG(1) << "Unable to verify SCT signature."; | 217 DVLOG(1) << "Unable to verify SCT signature."; |
218 result->invalid_scts.push_back(sct); | 218 result->invalid_scts.push_back(sct); |
219 LogSCTStatusToUMA(ct::SCT_STATUS_INVALID); | 219 LogSCTStatusToUMA(ct::SCT_STATUS_INVALID); |
220 return false; | 220 return false; |
221 } | 221 } |
222 | 222 |
223 // SCT verified ok, just make sure the timestamp is legitimate. | 223 // SCT verified ok, just make sure the timestamp is legitimate. |
224 if (sct->timestamp > base::Time::Now()) { | 224 if (sct->timestamp > base::Time::Now()) { |
225 DVLOG(1) << "SCT is from the future!"; | 225 DVLOG(1) << "SCT is from the future!"; |
226 result->invalid_scts.push_back(sct); | 226 result->invalid_scts.push_back(sct); |
227 LogSCTStatusToUMA(ct::SCT_STATUS_INVALID); | 227 LogSCTStatusToUMA(ct::SCT_STATUS_INVALID); |
228 return false; | 228 return false; |
229 } | 229 } |
230 | 230 |
231 LogSCTStatusToUMA(ct::SCT_STATUS_OK); | 231 LogSCTStatusToUMA(ct::SCT_STATUS_OK); |
232 result->verified_scts.push_back(sct); | 232 result->verified_scts.push_back(sct); |
233 return true; | 233 return true; |
234 } | 234 } |
235 | 235 |
236 } // namespace net | 236 } // namespace net |
OLD | NEW |