| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 int MultiLogCTVerifier::Verify( | 29 int MultiLogCTVerifier::Verify( |
| 30 X509Certificate* cert, | 30 X509Certificate* cert, |
| 31 const std::string& sct_list_from_ocsp, | 31 const std::string& sct_list_from_ocsp, |
| 32 const std::string& sct_list_from_tls_extension, | 32 const std::string& sct_list_from_tls_extension, |
| 33 ct::CTVerifyResult* result) { | 33 ct::CTVerifyResult* result) { |
| 34 DCHECK(cert); | 34 DCHECK(cert); |
| 35 DCHECK(result); | 35 DCHECK(result); |
| 36 | 36 |
| 37 result->verified_scts.clear(); | 37 result->verified_scts.clear(); |
| 38 result->unverified_scts.clear(); | 38 result->invalid_scts.clear(); |
| 39 result->unknown_logs_scts.clear(); | 39 result->unknown_logs_scts.clear(); |
| 40 | 40 |
| 41 bool has_verified_scts = false; | 41 bool has_verified_scts = false; |
| 42 | 42 |
| 43 std::string embedded_scts; | 43 std::string embedded_scts; |
| 44 if (!cert->GetIntermediateCertificates().empty() && | 44 if (!cert->GetIntermediateCertificates().empty() && |
| 45 ct::ExtractEmbeddedSCTList( | 45 ct::ExtractEmbeddedSCTList( |
| 46 cert->os_cert_handle(), | 46 cert->os_cert_handle(), |
| 47 &embedded_scts)) { | 47 &embedded_scts)) { |
| 48 ct::LogEntry precert_entry; | 48 ct::LogEntry precert_entry; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // Assume this SCT is untrusted until proven otherwise. | 121 // Assume this SCT is untrusted until proven otherwise. |
| 122 IDToLogMap::iterator it = logs_.find(sct->log_id); | 122 IDToLogMap::iterator it = logs_.find(sct->log_id); |
| 123 if (it == logs_.end()) { | 123 if (it == logs_.end()) { |
| 124 DVLOG(1) << "SCT does not match any known log."; | 124 DVLOG(1) << "SCT does not match any known log."; |
| 125 result->unknown_logs_scts.push_back(sct); | 125 result->unknown_logs_scts.push_back(sct); |
| 126 return false; | 126 return false; |
| 127 } | 127 } |
| 128 | 128 |
| 129 if (!it->second->Verify(expected_entry, *sct)) { | 129 if (!it->second->Verify(expected_entry, *sct)) { |
| 130 DVLOG(1) << "Unable to verify SCT signature."; | 130 DVLOG(1) << "Unable to verify SCT signature."; |
| 131 result->unverified_scts.push_back(sct); | 131 result->invalid_scts.push_back(sct); |
| 132 return false; | 132 return false; |
| 133 } | 133 } |
| 134 | 134 |
| 135 // SCT verified ok, just make sure the timestamp is legitimate. | 135 // SCT verified ok, just make sure the timestamp is legitimate. |
| 136 if (sct->timestamp > base::Time::Now()) { | 136 if (sct->timestamp > base::Time::Now()) { |
| 137 DVLOG(1) << "SCT is from the future!"; | 137 DVLOG(1) << "SCT is from the future!"; |
| 138 result->unverified_scts.push_back(sct); | 138 result->invalid_scts.push_back(sct); |
| 139 return false; | 139 return false; |
| 140 } | 140 } |
| 141 | 141 |
| 142 result->verified_scts.push_back(sct); | 142 result->verified_scts.push_back(sct); |
| 143 return true; | 143 return true; |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // namespace net | 146 } // namespace net |
| OLD | NEW |