| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/tools/cert_verify_tool/verify_using_path_builder.h" | 5 #include "net/tools/cert_verify_tool/verify_using_path_builder.h" |
| 6 | 6 |
| 7 #include <iostream> | 7 #include <iostream> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 | 255 |
| 256 scoped_refptr<net::ParsedCertificate> target_cert = | 256 scoped_refptr<net::ParsedCertificate> target_cert = |
| 257 ParseCertificate(target_der_cert); | 257 ParseCertificate(target_der_cert); |
| 258 if (!target_cert) | 258 if (!target_cert) |
| 259 return false; | 259 return false; |
| 260 | 260 |
| 261 // Verify the chain. | 261 // Verify the chain. |
| 262 net::SimpleSignaturePolicy signature_policy(2048); | 262 net::SimpleSignaturePolicy signature_policy(2048); |
| 263 net::CertPathBuilder::Result result; | 263 net::CertPathBuilder::Result result; |
| 264 net::CertPathBuilder path_builder(target_cert, &trust_store, | 264 net::CertPathBuilder path_builder(target_cert, &trust_store, |
| 265 &signature_policy, time, &result); | 265 &signature_policy, time, |
| 266 net::KeyPurpose::SERVER_AUTH, &result); |
| 266 path_builder.AddCertIssuerSource(&intermediate_cert_issuer_source); | 267 path_builder.AddCertIssuerSource(&intermediate_cert_issuer_source); |
| 267 #if defined(USE_NSS_CERTS) | 268 #if defined(USE_NSS_CERTS) |
| 268 net::CertIssuerSourceNSS cert_issuer_source_nss; | 269 net::CertIssuerSourceNSS cert_issuer_source_nss; |
| 269 path_builder.AddCertIssuerSource(&cert_issuer_source_nss); | 270 path_builder.AddCertIssuerSource(&cert_issuer_source_nss); |
| 270 #endif | 271 #endif |
| 271 | 272 |
| 272 // Create a network thread to be used for AIA fetches, and wait for a | 273 // Create a network thread to be used for AIA fetches, and wait for a |
| 273 // CertNetFetcher to be constructed on that thread. | 274 // CertNetFetcher to be constructed on that thread. |
| 274 base::Thread::Options options(base::MessageLoop::TYPE_IO, 0); | 275 base::Thread::Options options(base::MessageLoop::TYPE_IO, 0); |
| 275 base::Thread thread("network_thread"); | 276 base::Thread thread("network_thread"); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 if (!DumpParsedCertificateChain( | 317 if (!DumpParsedCertificateChain( |
| 317 dump_prefix_path.AddExtension( | 318 dump_prefix_path.AddExtension( |
| 318 FILE_PATH_LITERAL(".CertPathBuilder.pem")), | 319 FILE_PATH_LITERAL(".CertPathBuilder.pem")), |
| 319 result.paths[result.best_result_index]->path)) { | 320 result.paths[result.best_result_index]->path)) { |
| 320 return false; | 321 return false; |
| 321 } | 322 } |
| 322 } | 323 } |
| 323 | 324 |
| 324 return result.HasValidPath(); | 325 return result.HasValidPath(); |
| 325 } | 326 } |
| OLD | NEW |