Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1043)

Side by Side Diff: net/tools/cert_verify_tool/verify_using_path_builder.cc

Issue 2800993002: Add a key purpose parameter to Certificate PathBuilder. (Closed)
Patch Set: rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/tools/cert_verify_tool/cert_verify_tool.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « net/tools/cert_verify_tool/cert_verify_tool.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698