Chromium Code Reviews| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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; | 124 TestNetLog test_net_log; |
| 125 NetLogWithSource net_log = | 125 NetLogWithSource net_log = NetLogWithSource::Make( |
| 126 NetLogWithSource::Make(&test_net_log, NetLogSourceType::CONNECT_JOB); | 126 &test_net_log, NetLogSourceType::SSL_CONNECT_JOB); |
|
mmenke
2016/11/30 15:09:24
Do these actually matter, or could you just use Ne
davidben
2016/11/30 17:37:49
This one doesn't seem to, but the one below checks
| |
| 127 | 127 |
| 128 return verifier_->Verify(chain.get(), std::string(), std::string(), &scts, | 128 return verifier_->Verify(chain.get(), std::string(), std::string(), &scts, |
| 129 net_log) == OK; | 129 net_log) == OK; |
| 130 } | 130 } |
| 131 | 131 |
| 132 bool CheckPrecertificateVerification(scoped_refptr<X509Certificate> chain) { | 132 bool CheckPrecertificateVerification(scoped_refptr<X509Certificate> chain) { |
| 133 SignedCertificateTimestampAndStatusList scts; | 133 SignedCertificateTimestampAndStatusList scts; |
| 134 TestNetLog test_net_log; | 134 TestNetLog test_net_log; |
| 135 NetLogWithSource net_log = | 135 NetLogWithSource net_log = NetLogWithSource::Make( |
| 136 NetLogWithSource::Make(&test_net_log, NetLogSourceType::CONNECT_JOB); | 136 &test_net_log, NetLogSourceType::SSL_CONNECT_JOB); |
| 137 return (VerifySinglePrecertificateChain(chain, net_log, &scts) && | 137 return (VerifySinglePrecertificateChain(chain, net_log, &scts) && |
| 138 ct::CheckForSingleVerifiedSCTInResult(scts, kLogDescription) && | 138 ct::CheckForSingleVerifiedSCTInResult(scts, kLogDescription) && |
| 139 ct::CheckForSCTOrigin( | 139 ct::CheckForSCTOrigin( |
| 140 scts, ct::SignedCertificateTimestamp::SCT_EMBEDDED) && | 140 scts, ct::SignedCertificateTimestamp::SCT_EMBEDDED) && |
| 141 CheckForEmbeddedSCTInNetLog(test_net_log)); | 141 CheckForEmbeddedSCTInNetLog(test_net_log)); |
| 142 } | 142 } |
| 143 | 143 |
| 144 // Histogram-related helper methods | 144 // Histogram-related helper methods |
| 145 int GetValueFromHistogram(const std::string& histogram_name, | 145 int GetValueFromHistogram(const std::string& histogram_name, |
| 146 int sample_index) { | 146 int sample_index) { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 Mock::VerifyAndClearExpectations(&observer); | 291 Mock::VerifyAndClearExpectations(&observer); |
| 292 | 292 |
| 293 EXPECT_CALL(observer, OnSCTVerified(embedded_sct_chain_.get(), _)).Times(0); | 293 EXPECT_CALL(observer, OnSCTVerified(embedded_sct_chain_.get(), _)).Times(0); |
| 294 verifier_->SetObserver(nullptr); | 294 verifier_->SetObserver(nullptr); |
| 295 ASSERT_TRUE(VerifySinglePrecertificateChain(embedded_sct_chain_)); | 295 ASSERT_TRUE(VerifySinglePrecertificateChain(embedded_sct_chain_)); |
| 296 } | 296 } |
| 297 | 297 |
| 298 } // namespace | 298 } // namespace |
| 299 | 299 |
| 300 } // namespace net | 300 } // namespace net |
| OLD | NEW |