| 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 <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 bool VerifySinglePrecertificateChain( | 114 bool VerifySinglePrecertificateChain( |
| 115 scoped_refptr<X509Certificate> chain, | 115 scoped_refptr<X509Certificate> chain, |
| 116 const NetLogWithSource& net_log, | 116 const NetLogWithSource& net_log, |
| 117 SignedCertificateTimestampAndStatusList* output_scts) { | 117 SignedCertificateTimestampAndStatusList* output_scts) { |
| 118 return verifier_->Verify(chain.get(), std::string(), std::string(), | 118 return verifier_->Verify(chain.get(), std::string(), std::string(), |
| 119 output_scts, net_log) == OK; | 119 output_scts, net_log) == OK; |
| 120 } | 120 } |
| 121 | 121 |
| 122 bool VerifySinglePrecertificateChain(scoped_refptr<X509Certificate> chain) { | 122 bool VerifySinglePrecertificateChain(scoped_refptr<X509Certificate> chain) { |
| 123 SignedCertificateTimestampAndStatusList scts; | 123 SignedCertificateTimestampAndStatusList scts; |
| 124 TestNetLog test_net_log; | |
| 125 NetLogWithSource net_log = | |
| 126 NetLogWithSource::Make(&test_net_log, NetLogSourceType::CONNECT_JOB); | |
| 127 | |
| 128 return verifier_->Verify(chain.get(), std::string(), std::string(), &scts, | 124 return verifier_->Verify(chain.get(), std::string(), std::string(), &scts, |
| 129 net_log) == OK; | 125 NetLogWithSource()) == OK; |
| 130 } | 126 } |
| 131 | 127 |
| 132 bool CheckPrecertificateVerification(scoped_refptr<X509Certificate> chain) { | 128 bool CheckPrecertificateVerification(scoped_refptr<X509Certificate> chain) { |
| 133 SignedCertificateTimestampAndStatusList scts; | 129 SignedCertificateTimestampAndStatusList scts; |
| 134 TestNetLog test_net_log; | 130 TestNetLog test_net_log; |
| 135 NetLogWithSource net_log = | 131 NetLogWithSource net_log = NetLogWithSource::Make( |
| 136 NetLogWithSource::Make(&test_net_log, NetLogSourceType::CONNECT_JOB); | 132 &test_net_log, NetLogSourceType::SSL_CONNECT_JOB); |
| 137 return (VerifySinglePrecertificateChain(chain, net_log, &scts) && | 133 return (VerifySinglePrecertificateChain(chain, net_log, &scts) && |
| 138 ct::CheckForSingleVerifiedSCTInResult(scts, kLogDescription) && | 134 ct::CheckForSingleVerifiedSCTInResult(scts, kLogDescription) && |
| 139 ct::CheckForSCTOrigin( | 135 ct::CheckForSCTOrigin( |
| 140 scts, ct::SignedCertificateTimestamp::SCT_EMBEDDED) && | 136 scts, ct::SignedCertificateTimestamp::SCT_EMBEDDED) && |
| 141 CheckForEmbeddedSCTInNetLog(test_net_log)); | 137 CheckForEmbeddedSCTInNetLog(test_net_log)); |
| 142 } | 138 } |
| 143 | 139 |
| 144 // Histogram-related helper methods | 140 // Histogram-related helper methods |
| 145 int GetValueFromHistogram(const std::string& histogram_name, | 141 int GetValueFromHistogram(const std::string& histogram_name, |
| 146 int sample_index) { | 142 int sample_index) { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 Mock::VerifyAndClearExpectations(&observer); | 287 Mock::VerifyAndClearExpectations(&observer); |
| 292 | 288 |
| 293 EXPECT_CALL(observer, OnSCTVerified(embedded_sct_chain_.get(), _)).Times(0); | 289 EXPECT_CALL(observer, OnSCTVerified(embedded_sct_chain_.get(), _)).Times(0); |
| 294 verifier_->SetObserver(nullptr); | 290 verifier_->SetObserver(nullptr); |
| 295 ASSERT_TRUE(VerifySinglePrecertificateChain(embedded_sct_chain_)); | 291 ASSERT_TRUE(VerifySinglePrecertificateChain(embedded_sct_chain_)); |
| 296 } | 292 } |
| 297 | 293 |
| 298 } // namespace | 294 } // namespace |
| 299 | 295 |
| 300 } // namespace net | 296 } // namespace net |
| OLD | NEW |