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

Side by Side Diff: net/cert/internal/verify_certificate_chain.cc

Issue 2292333002: Add errors per ResultPath for CertPathBuilder. (Closed)
Patch Set: Created 4 years, 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/internal/verify_certificate_chain.h" 5 #include "net/cert/internal/verify_certificate_chain.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "net/cert/internal/cert_errors.h" 10 #include "net/cert/internal/cert_errors.h"
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 448
449 } // namespace 449 } // namespace
450 450
451 // This implementation is structured to mimic the description of certificate 451 // This implementation is structured to mimic the description of certificate
452 // path verification given by RFC 5280 section 6.1. 452 // path verification given by RFC 5280 section 6.1.
453 bool VerifyCertificateChain(const ParsedCertificateList& certs, 453 bool VerifyCertificateChain(const ParsedCertificateList& certs,
454 const TrustAnchor* trust_anchor, 454 const TrustAnchor* trust_anchor,
455 const SignaturePolicy* signature_policy, 455 const SignaturePolicy* signature_policy,
456 const der::GeneralizedTime& time, 456 const der::GeneralizedTime& time,
457 CertErrors* errors) { 457 CertErrors* errors) {
458 DCHECK(trust_anchor);
459 DCHECK(signature_policy); 458 DCHECK(signature_policy);
460 DCHECK(errors); 459 DCHECK(errors);
461 460
462 // An empty chain is necessarily invalid. 461 // An empty chain is necessarily invalid.
463 if (certs.empty()) { 462 if (certs.empty()) {
464 errors->Add(kChainIsEmpty); 463 errors->Add(kChainIsEmpty);
465 return false; 464 return false;
466 } 465 }
467 466
467 if (!trust_anchor) {
mattm 2016/08/31 19:49:49 does something hit this currently? or just to be m
eroman 2016/08/31 21:46:50 Good question, let me run a test to find out. The
eroman 2016/08/31 21:55:37 Ran the tests -- nothing reaches this. ... which
eroman 2016/09/01 03:44:51 Done -- removed
468 errors->Add(kNullTrustAnchor);
469 return false;
470 }
471
468 // Will contain a NameConstraints for each previous cert in the chain which 472 // Will contain a NameConstraints for each previous cert in the chain which
469 // had nameConstraints. This corresponds to the permitted_subtrees and 473 // had nameConstraints. This corresponds to the permitted_subtrees and
470 // excluded_subtrees state variables from RFC 5280. 474 // excluded_subtrees state variables from RFC 5280.
471 std::vector<const NameConstraints*> name_constraints_list; 475 std::vector<const NameConstraints*> name_constraints_list;
472 476
473 // |working_spki| is an amalgamation of 3 separate variables from RFC 5280: 477 // |working_spki| is an amalgamation of 3 separate variables from RFC 5280:
474 // * working_public_key 478 // * working_public_key
475 // * working_public_key_algorithm 479 // * working_public_key_algorithm
476 // * working_public_key_parameters 480 // * working_public_key_parameters
477 // 481 //
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 "Not permitted by name constraints"); 588 "Not permitted by name constraints");
585 DEFINE_CERT_ERROR_TYPE(kSubjectDoesNotMatchIssuer, 589 DEFINE_CERT_ERROR_TYPE(kSubjectDoesNotMatchIssuer,
586 "subject does not match issuer"); 590 "subject does not match issuer");
587 DEFINE_CERT_ERROR_TYPE(kSignatureVerificationFailed, 591 DEFINE_CERT_ERROR_TYPE(kSignatureVerificationFailed,
588 "Signature verification failed"); 592 "Signature verification failed");
589 DEFINE_CERT_ERROR_TYPE(kValidityFailedNotAfter, "Time is after notAfter"); 593 DEFINE_CERT_ERROR_TYPE(kValidityFailedNotAfter, "Time is after notAfter");
590 DEFINE_CERT_ERROR_TYPE(kValidityFailedNotBefore, "Time is before notBefore"); 594 DEFINE_CERT_ERROR_TYPE(kValidityFailedNotBefore, "Time is before notBefore");
591 DEFINE_CERT_ERROR_TYPE(kSignatureAlgorithmsDifferentEncoding, 595 DEFINE_CERT_ERROR_TYPE(kSignatureAlgorithmsDifferentEncoding,
592 "Certificate.signatureAlgorithm is encoded differently " 596 "Certificate.signatureAlgorithm is encoded differently "
593 "than TBSCertificate.signature"); 597 "than TBSCertificate.signature");
598 DEFINE_CERT_ERROR_TYPE(kNullTrustAnchor, "Missing trust anchor");
594 599
595 } // verify_certificate_chain_errors 600 } // verify_certificate_chain_errors
596 601
597 } // namespace net 602 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698