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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 if (it == logs_.end()) { | 192 if (it == logs_.end()) { |
193 DVLOG(1) << "SCT does not match any known log."; | 193 DVLOG(1) << "SCT does not match any known log."; |
194 AddSCTAndLogStatus(sct, ct::SCT_STATUS_LOG_UNKNOWN, &(result->scts)); | 194 AddSCTAndLogStatus(sct, ct::SCT_STATUS_LOG_UNKNOWN, &(result->scts)); |
195 return false; | 195 return false; |
196 } | 196 } |
197 | 197 |
198 sct->log_description = it->second->description(); | 198 sct->log_description = it->second->description(); |
199 | 199 |
200 if (!it->second->Verify(expected_entry, *sct.get())) { | 200 if (!it->second->Verify(expected_entry, *sct.get())) { |
201 DVLOG(1) << "Unable to verify SCT signature."; | 201 DVLOG(1) << "Unable to verify SCT signature."; |
202 AddSCTAndLogStatus(sct, ct::SCT_STATUS_INVALID, &(result->scts)); | 202 AddSCTAndLogStatus(sct, ct::SCT_STATUS_INVALID_SIGNATURE, &(result->scts)); |
203 return false; | 203 return false; |
204 } | 204 } |
205 | 205 |
206 // SCT verified ok, just make sure the timestamp is legitimate. | 206 // SCT verified ok, just make sure the timestamp is legitimate. |
207 if (sct->timestamp > base::Time::Now()) { | 207 if (sct->timestamp > base::Time::Now()) { |
208 DVLOG(1) << "SCT is from the future!"; | 208 DVLOG(1) << "SCT is from the future!"; |
209 AddSCTAndLogStatus(sct, ct::SCT_STATUS_INVALID, &(result->scts)); | 209 AddSCTAndLogStatus(sct, ct::SCT_STATUS_INVALID_TIMESTAMP, &(result->scts)); |
210 return false; | 210 return false; |
211 } | 211 } |
212 | 212 |
213 AddSCTAndLogStatus(sct, ct::SCT_STATUS_OK, &(result->scts)); | 213 AddSCTAndLogStatus(sct, ct::SCT_STATUS_OK, &(result->scts)); |
214 if (observer_) | 214 if (observer_) |
215 observer_->OnSCTVerified(cert, sct.get()); | 215 observer_->OnSCTVerified(cert, sct.get()); |
216 return true; | 216 return true; |
217 } | 217 } |
218 | 218 |
219 } // namespace net | 219 } // namespace net |
OLD | NEW |