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 "components/cast_certificate/cast_cert_validator.h" | 5 #include "components/cast_certificate/cast_cert_validator.h" |
6 | 6 |
7 #include "components/cast_certificate/cast_cert_validator_test_helpers.h" | 7 #include "components/cast_certificate/cast_cert_validator_test_helpers.h" |
8 #include "net/cert/internal/cert_errors.h" | 8 #include "net/cert/internal/cert_errors.h" |
9 #include "net/cert/internal/parsed_certificate.h" | 9 #include "net/cert/internal/parsed_certificate.h" |
10 #include "net/cert/internal/trust_store_in_memory.h" | 10 #include "net/cert/internal/trust_store_in_memory.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 trust_store->AddTrustAnchor( | 102 trust_store->AddTrustAnchor( |
103 net::TrustAnchor::CreateFromCertificateWithConstraints( | 103 net::TrustAnchor::CreateFromCertificateWithConstraints( |
104 std::move(root))); | 104 std::move(root))); |
105 } | 105 } |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
109 std::unique_ptr<CertVerificationContext> context; | 109 std::unique_ptr<CertVerificationContext> context; |
110 CastDeviceCertPolicy policy; | 110 CastDeviceCertPolicy policy; |
111 | 111 |
112 bool result; | 112 bool result = VerifyDeviceCertUsingCustomTrustStore( |
113 if (trust_store.get()) { | 113 certs, time, &context, &policy, nullptr, CRLPolicy::CRL_OPTIONAL, |
114 result = | 114 trust_store.get()); |
115 VerifyDeviceCertForTest(certs, time, &context, &policy, nullptr, | |
116 CRLPolicy::CRL_OPTIONAL, trust_store.get()); | |
117 } else { | |
118 result = VerifyDeviceCert(certs, time, &context, &policy, nullptr, | |
119 CRLPolicy::CRL_OPTIONAL); | |
120 } | |
121 | 115 |
122 if (expected_result == RESULT_FAIL) { | 116 if (expected_result == RESULT_FAIL) { |
123 ASSERT_FALSE(result); | 117 ASSERT_FALSE(result); |
124 return; | 118 return; |
125 } | 119 } |
126 | 120 |
127 ASSERT_TRUE(result); | 121 ASSERT_TRUE(result); |
128 EXPECT_EQ(expected_policy, policy); | 122 EXPECT_EQ(expected_policy, policy); |
129 ASSERT_TRUE(context.get()); | 123 ASSERT_TRUE(context.get()); |
130 | 124 |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 auto context = | 546 auto context = |
553 CertVerificationContextImplForTest(CreateString(kEx2PublicKeySpki)); | 547 CertVerificationContextImplForTest(CreateString(kEx2PublicKeySpki)); |
554 | 548 |
555 EXPECT_TRUE(context->VerifySignatureOverData(CreateString(kEx2Signature), | 549 EXPECT_TRUE(context->VerifySignatureOverData(CreateString(kEx2Signature), |
556 CreateString(kEx2Message))); | 550 CreateString(kEx2Message))); |
557 } | 551 } |
558 | 552 |
559 } // namespace | 553 } // namespace |
560 | 554 |
561 } // namespace cast_certificate | 555 } // namespace cast_certificate |
OLD | NEW |