| 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/verify_certificate_chain.h" | 5 #include "net/cert/internal/verify_certificate_chain.h" |
| 6 | 6 |
| 7 #include "net/cert/internal/parse_certificate.h" | 7 #include "net/cert/internal/parse_certificate.h" |
| 8 #include "net/cert/internal/signature_policy.h" | 8 #include "net/cert/internal/signature_policy.h" |
| 9 #include "net/der/input.h" | 9 #include "net/der/input.h" |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 class VerifyCertificateChainPkitsTestDelegate { | 46 class VerifyCertificateChainPkitsTestDelegate { |
| 47 public: | 47 public: |
| 48 static bool Verify(std::vector<std::string> cert_ders, | 48 static bool Verify(std::vector<std::string> cert_ders, |
| 49 std::vector<std::string> crl_ders) { | 49 std::vector<std::string> crl_ders) { |
| 50 if (cert_ders.empty()) { | 50 if (cert_ders.empty()) { |
| 51 ADD_FAILURE() << "cert_ders is empty"; | 51 ADD_FAILURE() << "cert_ders is empty"; |
| 52 return false; | 52 return false; |
| 53 } | 53 } |
| 54 // First entry in the PKITS chain is the trust anchor. | 54 // First entry in the PKITS chain is the trust anchor. |
| 55 TrustStore trust_store; | 55 TrustStore trust_store; |
| 56 EXPECT_TRUE(trust_store.AddTrustedCertificate(cert_ders[0])); | 56 scoped_refptr<CertThing> anchor( |
| 57 CertThing::CreateFromCertificateCopy(cert_ders[0])); |
| 58 EXPECT_TRUE(anchor); |
| 59 if (anchor) |
| 60 trust_store.AddTrustedCertificate(std::move(anchor)); |
| 57 | 61 |
| 58 // PKITS lists chains from trust anchor to target, VerifyCertificateChain | 62 // PKITS lists chains from trust anchor to target, VerifyCertificateChain |
| 59 // takes them starting with the target and not including the trust anchor. | 63 // takes them starting with the target and not including the trust anchor. |
| 60 std::vector<der::Input> input_chain; | 64 std::vector<der::Input> input_chain; |
| 61 for (size_t i = cert_ders.size() - 1; i > 0; --i) | 65 for (size_t i = cert_ders.size() - 1; i > 0; --i) |
| 62 input_chain.push_back(der::Input(&cert_ders[i])); | 66 input_chain.push_back(der::Input(&cert_ders[i])); |
| 63 | 67 |
| 64 SimpleSignaturePolicy signature_policy(1024); | 68 SimpleSignaturePolicy signature_policy(1024); |
| 65 | 69 |
| 66 // Run all tests at the time the PKITS was published. | 70 // Run all tests at the time the PKITS was published. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 200 |
| 197 // TODO(mattm): CRL support: PkitsTest04BasicCertificateRevocationTests, | 201 // TODO(mattm): CRL support: PkitsTest04BasicCertificateRevocationTests, |
| 198 // PkitsTest05VerifyingPathswithSelfIssuedCertificates, | 202 // PkitsTest05VerifyingPathswithSelfIssuedCertificates, |
| 199 // PkitsTest14DistributionPoints, PkitsTest15DeltaCRLs | 203 // PkitsTest14DistributionPoints, PkitsTest15DeltaCRLs |
| 200 | 204 |
| 201 // TODO(mattm): Certificate Policies support: PkitsTest08CertificatePolicies, | 205 // TODO(mattm): Certificate Policies support: PkitsTest08CertificatePolicies, |
| 202 // PkitsTest09RequireExplicitPolicy PkitsTest10PolicyMappings, | 206 // PkitsTest09RequireExplicitPolicy PkitsTest10PolicyMappings, |
| 203 // PkitsTest11InhibitPolicyMapping, PkitsTest12InhibitAnyPolicy | 207 // PkitsTest11InhibitPolicyMapping, PkitsTest12InhibitAnyPolicy |
| 204 | 208 |
| 205 } // namespace net | 209 } // namespace net |
| OLD | NEW |