| 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 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 for (size_t i = 0; i < arraysize(tests); ++i) { | 656 for (size_t i = 0; i < arraysize(tests); ++i) { |
| 657 scoped_refptr<X509Certificate> certificate = | 657 scoped_refptr<X509Certificate> certificate = |
| 658 ImportCertFromFile(certs_dir, tests[i].file); | 658 ImportCertFromFile(certs_dir, tests[i].file); |
| 659 SCOPED_TRACE(tests[i].file); | 659 SCOPED_TRACE(tests[i].file); |
| 660 ASSERT_TRUE(certificate); | 660 ASSERT_TRUE(certificate); |
| 661 EXPECT_EQ(tests[i].is_valid_too_long, | 661 EXPECT_EQ(tests[i].is_valid_too_long, |
| 662 CertVerifyProc::HasTooLongValidity(*certificate)); | 662 CertVerifyProc::HasTooLongValidity(*certificate)); |
| 663 } | 663 } |
| 664 } | 664 } |
| 665 | 665 |
| 666 TEST_F(CertVerifyProcTest, TestKnownRoot) { | 666 // TODO(crbug.com/610546): Fix and re-enable this test. |
| 667 TEST_F(CertVerifyProcTest, DISABLED_TestKnownRoot) { |
| 667 if (!SupportsDetectingKnownRoots()) { | 668 if (!SupportsDetectingKnownRoots()) { |
| 668 LOG(INFO) << "Skipping this test on this platform."; | 669 LOG(INFO) << "Skipping this test on this platform."; |
| 669 return; | 670 return; |
| 670 } | 671 } |
| 671 | 672 |
| 672 base::FilePath certs_dir = GetTestCertsDirectory(); | 673 base::FilePath certs_dir = GetTestCertsDirectory(); |
| 673 CertificateList certs = CreateCertificateListFromFile( | 674 CertificateList certs = CreateCertificateListFromFile( |
| 674 certs_dir, "twitter-chain.pem", X509Certificate::FORMAT_AUTO); | 675 certs_dir, "twitter-chain.pem", X509Certificate::FORMAT_AUTO); |
| 675 ASSERT_EQ(3U, certs.size()); | 676 ASSERT_EQ(3U, certs.size()); |
| 676 | 677 |
| 677 X509Certificate::OSCertHandles intermediates; | 678 X509Certificate::OSCertHandles intermediates; |
| 678 intermediates.push_back(certs[1]->os_cert_handle()); | 679 intermediates.push_back(certs[1]->os_cert_handle()); |
| 679 | 680 |
| 680 scoped_refptr<X509Certificate> cert_chain = | 681 scoped_refptr<X509Certificate> cert_chain = |
| 681 X509Certificate::CreateFromHandle(certs[0]->os_cert_handle(), | 682 X509Certificate::CreateFromHandle(certs[0]->os_cert_handle(), |
| 682 intermediates); | 683 intermediates); |
| 683 | 684 |
| 684 int flags = 0; | 685 int flags = 0; |
| 685 CertVerifyResult verify_result; | 686 CertVerifyResult verify_result; |
| 686 // This will blow up, May 9th, 2016. Sorry! Please disable and file a bug | 687 // This will blow up, May 9th, 2016. Sorry! Please disable and file a bug |
| 687 // against agl. See also PublicKeyHashes. | 688 // against agl. See also PublicKeyHashes. |
| 688 int error = Verify(cert_chain.get(), "twitter.com", flags, NULL, | 689 int error = Verify(cert_chain.get(), "twitter.com", flags, NULL, |
| 689 empty_cert_list_, &verify_result); | 690 empty_cert_list_, &verify_result); |
| 690 EXPECT_EQ(OK, error); | 691 EXPECT_EQ(OK, error); |
| 691 EXPECT_TRUE(verify_result.is_issued_by_known_root); | 692 EXPECT_TRUE(verify_result.is_issued_by_known_root); |
| 692 } | 693 } |
| 693 | 694 |
| 694 TEST_F(CertVerifyProcTest, PublicKeyHashes) { | 695 // TODO(crbug.com/610546): Fix and re-enable this test. |
| 696 TEST_F(CertVerifyProcTest, DISABLED_PublicKeyHashes) { |
| 695 if (!SupportsReturningVerifiedChain()) { | 697 if (!SupportsReturningVerifiedChain()) { |
| 696 LOG(INFO) << "Skipping this test in this platform."; | 698 LOG(INFO) << "Skipping this test in this platform."; |
| 697 return; | 699 return; |
| 698 } | 700 } |
| 699 | 701 |
| 700 base::FilePath certs_dir = GetTestCertsDirectory(); | 702 base::FilePath certs_dir = GetTestCertsDirectory(); |
| 701 CertificateList certs = CreateCertificateListFromFile( | 703 CertificateList certs = CreateCertificateListFromFile( |
| 702 certs_dir, "twitter-chain.pem", X509Certificate::FORMAT_AUTO); | 704 certs_dir, "twitter-chain.pem", X509Certificate::FORMAT_AUTO); |
| 703 ASSERT_EQ(3U, certs.size()); | 705 ASSERT_EQ(3U, certs.size()); |
| 704 | 706 |
| (...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1707 int flags = 0; | 1709 int flags = 0; |
| 1708 CertVerifyResult verify_result; | 1710 CertVerifyResult verify_result; |
| 1709 int error = Verify(cert.get(), "127.0.0.1", flags, NULL, empty_cert_list_, | 1711 int error = Verify(cert.get(), "127.0.0.1", flags, NULL, empty_cert_list_, |
| 1710 &verify_result); | 1712 &verify_result); |
| 1711 EXPECT_EQ(ERR_CERT_INVALID, error); | 1713 EXPECT_EQ(ERR_CERT_INVALID, error); |
| 1712 EXPECT_EQ(CERT_STATUS_INVALID, verify_result.cert_status); | 1714 EXPECT_EQ(CERT_STATUS_INVALID, verify_result.cert_status); |
| 1713 } | 1715 } |
| 1714 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 1716 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 1715 | 1717 |
| 1716 } // namespace net | 1718 } // namespace net |
| OLD | NEW |