| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/cert_verify_proc.h" | 5 #include "net/cert/cert_verify_proc.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 for (size_t i = 0; i < arraysize(tests); ++i) { | 686 for (size_t i = 0; i < arraysize(tests); ++i) { |
| 687 scoped_refptr<X509Certificate> certificate = | 687 scoped_refptr<X509Certificate> certificate = |
| 688 ImportCertFromFile(certs_dir, tests[i].file); | 688 ImportCertFromFile(certs_dir, tests[i].file); |
| 689 SCOPED_TRACE(tests[i].file); | 689 SCOPED_TRACE(tests[i].file); |
| 690 ASSERT_TRUE(certificate); | 690 ASSERT_TRUE(certificate); |
| 691 EXPECT_EQ(tests[i].is_valid_too_long, | 691 EXPECT_EQ(tests[i].is_valid_too_long, |
| 692 CertVerifyProc::HasTooLongValidity(*certificate)); | 692 CertVerifyProc::HasTooLongValidity(*certificate)); |
| 693 } | 693 } |
| 694 } | 694 } |
| 695 | 695 |
| 696 TEST_F(CertVerifyProcTest, TestKnownRoot) { | 696 // TODO(crbug.com/610546): Fix and re-enable this test. |
| 697 TEST_F(CertVerifyProcTest, DISABLED_TestKnownRoot) { |
| 697 if (!SupportsDetectingKnownRoots()) { | 698 if (!SupportsDetectingKnownRoots()) { |
| 698 LOG(INFO) << "Skipping this test on this platform."; | 699 LOG(INFO) << "Skipping this test on this platform."; |
| 699 return; | 700 return; |
| 700 } | 701 } |
| 701 | 702 |
| 702 base::FilePath certs_dir = GetTestCertsDirectory(); | 703 base::FilePath certs_dir = GetTestCertsDirectory(); |
| 703 CertificateList certs = CreateCertificateListFromFile( | 704 CertificateList certs = CreateCertificateListFromFile( |
| 704 certs_dir, "twitter-chain.pem", X509Certificate::FORMAT_AUTO); | 705 certs_dir, "twitter-chain.pem", X509Certificate::FORMAT_AUTO); |
| 705 ASSERT_EQ(3U, certs.size()); | 706 ASSERT_EQ(3U, certs.size()); |
| 706 | 707 |
| 707 X509Certificate::OSCertHandles intermediates; | 708 X509Certificate::OSCertHandles intermediates; |
| 708 intermediates.push_back(certs[1]->os_cert_handle()); | 709 intermediates.push_back(certs[1]->os_cert_handle()); |
| 709 | 710 |
| 710 scoped_refptr<X509Certificate> cert_chain = | 711 scoped_refptr<X509Certificate> cert_chain = |
| 711 X509Certificate::CreateFromHandle(certs[0]->os_cert_handle(), | 712 X509Certificate::CreateFromHandle(certs[0]->os_cert_handle(), |
| 712 intermediates); | 713 intermediates); |
| 713 | 714 |
| 714 int flags = 0; | 715 int flags = 0; |
| 715 CertVerifyResult verify_result; | 716 CertVerifyResult verify_result; |
| 716 // This will blow up, May 9th, 2016. Sorry! Please disable and file a bug | 717 // This will blow up, May 9th, 2016. Sorry! Please disable and file a bug |
| 717 // against agl. See also PublicKeyHashes. | 718 // against agl. See also PublicKeyHashes. |
| 718 int error = Verify(cert_chain.get(), "twitter.com", flags, NULL, | 719 int error = Verify(cert_chain.get(), "twitter.com", flags, NULL, |
| 719 empty_cert_list_, &verify_result); | 720 empty_cert_list_, &verify_result); |
| 720 EXPECT_EQ(OK, error); | 721 EXPECT_EQ(OK, error); |
| 721 EXPECT_TRUE(verify_result.is_issued_by_known_root); | 722 EXPECT_TRUE(verify_result.is_issued_by_known_root); |
| 722 } | 723 } |
| 723 | 724 |
| 724 TEST_F(CertVerifyProcTest, PublicKeyHashes) { | 725 // TODO(crbug.com/610546): Fix and re-enable this test. |
| 726 TEST_F(CertVerifyProcTest, DISABLED_PublicKeyHashes) { |
| 725 if (!SupportsReturningVerifiedChain()) { | 727 if (!SupportsReturningVerifiedChain()) { |
| 726 LOG(INFO) << "Skipping this test in this platform."; | 728 LOG(INFO) << "Skipping this test in this platform."; |
| 727 return; | 729 return; |
| 728 } | 730 } |
| 729 | 731 |
| 730 base::FilePath certs_dir = GetTestCertsDirectory(); | 732 base::FilePath certs_dir = GetTestCertsDirectory(); |
| 731 CertificateList certs = CreateCertificateListFromFile( | 733 CertificateList certs = CreateCertificateListFromFile( |
| 732 certs_dir, "twitter-chain.pem", X509Certificate::FORMAT_AUTO); | 734 certs_dir, "twitter-chain.pem", X509Certificate::FORMAT_AUTO); |
| 733 ASSERT_EQ(3U, certs.size()); | 735 ASSERT_EQ(3U, certs.size()); |
| 734 | 736 |
| (...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1830 int flags = 0; | 1832 int flags = 0; |
| 1831 CertVerifyResult verify_result; | 1833 CertVerifyResult verify_result; |
| 1832 int error = Verify(cert.get(), "127.0.0.1", flags, NULL, empty_cert_list_, | 1834 int error = Verify(cert.get(), "127.0.0.1", flags, NULL, empty_cert_list_, |
| 1833 &verify_result); | 1835 &verify_result); |
| 1834 EXPECT_EQ(ERR_CERT_INVALID, error); | 1836 EXPECT_EQ(ERR_CERT_INVALID, error); |
| 1835 EXPECT_EQ(CERT_STATUS_INVALID, verify_result.cert_status); | 1837 EXPECT_EQ(CERT_STATUS_INVALID, verify_result.cert_status); |
| 1836 } | 1838 } |
| 1837 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 1839 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 1838 | 1840 |
| 1839 } // namespace net | 1841 } // namespace net |
| OLD | NEW |