| 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/cert/internal/path_builder.h" | 5 #include "net/cert/internal/path_builder.h" |
| 6 | 6 |
| 7 #include "net/base/net_errors.h" | 7 #include "net/base/net_errors.h" |
| 8 #include "net/cert/internal/cert_issuer_source_static.h" | 8 #include "net/cert/internal/cert_issuer_source_static.h" |
| 9 #include "net/cert/internal/parse_certificate.h" | 9 #include "net/cert/internal/parse_certificate.h" |
| 10 #include "net/cert/internal/parsed_certificate.h" | 10 #include "net/cert/internal/parsed_certificate.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 class PathBuilderPkitsTestDelegate { | 51 class PathBuilderPkitsTestDelegate { |
| 52 public: | 52 public: |
| 53 static bool Verify(std::vector<std::string> cert_ders, | 53 static bool Verify(std::vector<std::string> cert_ders, |
| 54 std::vector<std::string> crl_ders) { | 54 std::vector<std::string> crl_ders) { |
| 55 if (cert_ders.empty()) { | 55 if (cert_ders.empty()) { |
| 56 ADD_FAILURE() << "cert_ders is empty"; | 56 ADD_FAILURE() << "cert_ders is empty"; |
| 57 return false; | 57 return false; |
| 58 } | 58 } |
| 59 ParsedCertificateList certs; | 59 ParsedCertificateList certs; |
| 60 for (const std::string& der : cert_ders) { | 60 for (const std::string& der : cert_ders) { |
| 61 certs.push_back(ParsedCertificate::CreateFromCertificateCopy(der, {})); | 61 CertErrors errors; |
| 62 if (!certs.back()) { | 62 if (!ParsedCertificate::CreateAndAddToVector(der, {}, &certs, &errors)) { |
| 63 ADD_FAILURE() << "ParsedCertificate::CreateFromCertificateCopy failed"; | 63 ADD_FAILURE() << "ParseCertificate::CreateAndAddToVector() failed:\n" |
| 64 << errors.ToDebugString(); |
| 64 return false; | 65 return false; |
| 65 } | 66 } |
| 66 } | 67 } |
| 67 // First entry in the PKITS chain is the trust anchor. | 68 // First entry in the PKITS chain is the trust anchor. |
| 68 // TODO(mattm): test with all possible trust anchors in the trust store? | 69 // TODO(mattm): test with all possible trust anchors in the trust store? |
| 69 TrustStoreInMemory trust_store; | 70 TrustStoreInMemory trust_store; |
| 70 | 71 |
| 71 scoped_refptr<TrustAnchor> trust_anchor = | 72 scoped_refptr<TrustAnchor> trust_anchor = |
| 72 TrustAnchor::CreateFromCertificateNoConstraints(certs[0]); | 73 TrustAnchor::CreateFromCertificateNoConstraints(certs[0]); |
| 73 trust_store.AddTrustAnchor(std::move(trust_anchor)); | 74 trust_store.AddTrustAnchor(std::move(trust_anchor)); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 222 |
| 222 // TODO(mattm): CRL support: PkitsTest04BasicCertificateRevocationTests, | 223 // TODO(mattm): CRL support: PkitsTest04BasicCertificateRevocationTests, |
| 223 // PkitsTest05VerifyingPathswithSelfIssuedCertificates, | 224 // PkitsTest05VerifyingPathswithSelfIssuedCertificates, |
| 224 // PkitsTest14DistributionPoints, PkitsTest15DeltaCRLs | 225 // PkitsTest14DistributionPoints, PkitsTest15DeltaCRLs |
| 225 | 226 |
| 226 // TODO(mattm): Certificate Policies support: PkitsTest08CertificatePolicies, | 227 // TODO(mattm): Certificate Policies support: PkitsTest08CertificatePolicies, |
| 227 // PkitsTest09RequireExplicitPolicy PkitsTest10PolicyMappings, | 228 // PkitsTest09RequireExplicitPolicy PkitsTest10PolicyMappings, |
| 228 // PkitsTest11InhibitPolicyMapping, PkitsTest12InhibitAnyPolicy | 229 // PkitsTest11InhibitPolicyMapping, PkitsTest12InhibitAnyPolicy |
| 229 | 230 |
| 230 } // namespace net | 231 } // namespace net |
| OLD | NEW |