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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 &precert_entry) && | 54 &precert_entry) && |
55 VerifySCTs( | 55 VerifySCTs( |
56 embedded_scts, | 56 embedded_scts, |
57 precert_entry, | 57 precert_entry, |
58 ct::SignedCertificateTimestamp::SCT_EMBEDDED, | 58 ct::SignedCertificateTimestamp::SCT_EMBEDDED, |
59 result); | 59 result); |
60 } | 60 } |
61 | 61 |
62 ct::LogEntry x509_entry; | 62 ct::LogEntry x509_entry; |
63 if (!ct::GetX509LogEntry(cert->os_cert_handle(), &x509_entry)) | 63 if (!ct::GetX509LogEntry(cert->os_cert_handle(), &x509_entry)) |
64 return has_verified_scts ? OK : ERR_FAILED; | 64 return has_verified_scts ? OK : ERR_FAILED; |
wtc
2013/11/26 01:47:23
Please re-apply the changes that use the new CT-re
Eran M. (Google)
2013/11/26 14:45:53
Done.
| |
65 | 65 |
66 has_verified_scts |= VerifySCTs( | 66 has_verified_scts |= VerifySCTs( |
67 sct_list_from_ocsp, | 67 sct_list_from_ocsp, |
68 x509_entry, | 68 x509_entry, |
69 ct::SignedCertificateTimestamp::SCT_FROM_OCSP_RESPONSE, | 69 ct::SignedCertificateTimestamp::SCT_FROM_OCSP_RESPONSE, |
70 result); | 70 result); |
71 | 71 |
72 has_verified_scts |= VerifySCTs( | 72 has_verified_scts |= VerifySCTs( |
73 sct_list_from_tls_extension, | 73 sct_list_from_tls_extension, |
74 x509_entry, | 74 x509_entry, |
(...skipping 37 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 // Add 1 second to allow some slack for accepting SCTs which have *Just* | 136 // Add 1 second to allow some slack for accepting SCTs which have *Just* |
138 // been issued. | 137 // been issued. |
139 if (sct->timestamp > base::Time::Now()) { | 138 if (sct->timestamp > base::Time::Now()) { |
140 DVLOG(1) << "SCT is from the future!"; | 139 DVLOG(1) << "SCT is from the future!"; |
141 result->unverified_scts.push_back(sct); | 140 result->unverified_scts.push_back(sct); |
142 return false; | 141 return false; |
143 } | 142 } |
144 | 143 |
145 result->verified_scts.push_back(sct); | 144 result->verified_scts.push_back(sct); |
146 return true; | 145 return true; |
147 } | 146 } |
148 | 147 |
149 } // namespace net | 148 } // namespace net |
OLD | NEW |