OLD | NEW |
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/quic/crypto/proof_verifier_chromium.h" | 5 #include "net/quic/crypto/proof_verifier_chromium.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
9 #include "net/cert/cert_status_flags.h" | 9 #include "net/cert/cert_status_flags.h" |
10 #include "net/cert/cert_verifier.h" | 10 #include "net/cert/cert_verifier.h" |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 | 580 |
581 ASSERT_TRUE(details_.get()); | 581 ASSERT_TRUE(details_.get()); |
582 ProofVerifyDetailsChromium* verify_details = | 582 ProofVerifyDetailsChromium* verify_details = |
583 static_cast<ProofVerifyDetailsChromium*>(details_.get()); | 583 static_cast<ProofVerifyDetailsChromium*>(details_.get()); |
584 EXPECT_TRUE(verify_details->cert_verify_result.cert_status & | 584 EXPECT_TRUE(verify_details->cert_verify_result.cert_status & |
585 CERT_STATUS_PINNED_KEY_MISSING); | 585 CERT_STATUS_PINNED_KEY_MISSING); |
586 EXPECT_TRUE(verify_details->cert_verify_result.cert_status & | 586 EXPECT_TRUE(verify_details->cert_verify_result.cert_status & |
587 CERT_STATUS_CERTIFICATE_TRANSPARENCY_REQUIRED); | 587 CERT_STATUS_CERTIFICATE_TRANSPARENCY_REQUIRED); |
588 } | 588 } |
589 | 589 |
| 590 // Tests that the VerifyCertChain verifies certificates. |
| 591 TEST_F(ProofVerifierChromiumTest, VerifyCertChain) { |
| 592 scoped_refptr<X509Certificate> test_cert = GetTestServerCertificate(); |
| 593 ASSERT_TRUE(test_cert); |
| 594 |
| 595 CertVerifyResult dummy_result; |
| 596 dummy_result.verified_cert = test_cert; |
| 597 dummy_result.cert_status = 0; |
| 598 |
| 599 MockCertVerifier dummy_verifier; |
| 600 dummy_verifier.AddResultForCert(test_cert.get(), dummy_result, OK); |
| 601 |
| 602 ProofVerifierChromium proof_verifier(&dummy_verifier, &ct_policy_enforcer_, |
| 603 &transport_security_state_, |
| 604 ct_verifier_.get()); |
| 605 |
| 606 std::unique_ptr<DummyProofVerifierCallback> callback( |
| 607 new DummyProofVerifierCallback); |
| 608 QuicAsyncStatus status = proof_verifier.VerifyCertChain( |
| 609 kTestHostname, certs_, verify_context_.get(), &error_details_, &details_, |
| 610 std::move(callback)); |
| 611 ASSERT_EQ(QUIC_SUCCESS, status); |
| 612 |
| 613 ASSERT_TRUE(details_.get()); |
| 614 ProofVerifyDetailsChromium* verify_details = |
| 615 static_cast<ProofVerifyDetailsChromium*>(details_.get()); |
| 616 EXPECT_EQ(0u, verify_details->cert_verify_result.cert_status); |
| 617 } |
| 618 |
590 } // namespace test | 619 } // namespace test |
591 } // namespace net | 620 } // namespace net |
OLD | NEW |