Chromium Code Reviews| 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 "base/file_path.h" | 5 #include "base/file_path.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
| 9 #include "base/sha1.h" | 9 #include "base/sha1.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 695 } else { | 695 } else { |
| 696 EXPECT_EQ(OK, error); | 696 EXPECT_EQ(OK, error); |
| 697 EXPECT_EQ(0U, verify_result.cert_status & CERT_STATUS_WEAK_KEY); | 697 EXPECT_EQ(0U, verify_result.cert_status & CERT_STATUS_WEAK_KEY); |
| 698 } | 698 } |
| 699 } | 699 } |
| 700 } | 700 } |
| 701 | 701 |
| 702 TestRootCerts::GetInstance()->Clear(); | 702 TestRootCerts::GetInstance()->Clear(); |
| 703 } | 703 } |
| 704 | 704 |
| 705 // Test for bug 108514. | |
| 706 // The certificate expires on Fri Jul 20 19:40:39 2012. | |
| 707 TEST(X509CertificateTest, ExtraneousMD5RootCert) { | |
| 708 FilePath certs_dir = GetTestCertsDirectory(); | |
| 709 | |
| 710 scoped_refptr<X509Certificate> server_cert = | |
| 711 ImportCertFromFile(certs_dir, "images_etrade_wallst_com.pem"); | |
| 712 ASSERT_NE(static_cast<X509Certificate*>(NULL), server_cert); | |
| 713 | |
| 714 scoped_refptr<X509Certificate> intermediate_cert = | |
| 715 ImportCertFromFile(certs_dir, "globalsign_orgv1_ca.pem"); | |
| 716 ASSERT_NE(static_cast<X509Certificate*>(NULL), intermediate_cert); | |
| 717 | |
| 718 scoped_refptr<X509Certificate> md5_root_cert = | |
| 719 ImportCertFromFile(certs_dir, "globalsign_root_ca_md5.pem"); | |
| 720 ASSERT_NE(static_cast<X509Certificate*>(NULL), md5_root_cert); | |
| 721 | |
| 722 X509Certificate::OSCertHandles intermediates; | |
| 723 intermediates.push_back(intermediate_cert->os_cert_handle()); | |
| 724 intermediates.push_back(md5_root_cert->os_cert_handle()); | |
| 725 scoped_refptr<X509Certificate> cert_chain = | |
| 726 X509Certificate::CreateFromHandle(server_cert->os_cert_handle(), | |
| 727 intermediates); | |
| 728 | |
| 729 CertVerifyResult verify_result; | |
| 730 int flags = 0; | |
| 731 int error = cert_chain->Verify("images.etrade.wallst.com", flags, NULL, | |
|
Ryan Sleevi
2012/01/27 21:45:37
Can you file a bug and assign to me, and TODO here
| |
| 732 &verify_result); | |
| 733 if (error != OK) | |
| 734 EXPECT_EQ(ERR_CERT_DATE_INVALID, error); | |
| 735 | |
| 736 EXPECT_FALSE(verify_result.has_md5); | |
| 737 EXPECT_FALSE(verify_result.has_md5_ca); | |
| 738 } | |
| 739 | |
| 705 // Test for bug 94673. | 740 // Test for bug 94673. |
| 706 TEST(X509CertificateTest, GoogleDigiNotarTest) { | 741 TEST(X509CertificateTest, GoogleDigiNotarTest) { |
| 707 FilePath certs_dir = GetTestCertsDirectory(); | 742 FilePath certs_dir = GetTestCertsDirectory(); |
| 708 | 743 |
| 709 scoped_refptr<X509Certificate> server_cert = | 744 scoped_refptr<X509Certificate> server_cert = |
| 710 ImportCertFromFile(certs_dir, "google_diginotar.pem"); | 745 ImportCertFromFile(certs_dir, "google_diginotar.pem"); |
| 711 ASSERT_NE(static_cast<X509Certificate*>(NULL), server_cert); | 746 ASSERT_NE(static_cast<X509Certificate*>(NULL), server_cert); |
| 712 | 747 |
| 713 scoped_refptr<X509Certificate> intermediate_cert = | 748 scoped_refptr<X509Certificate> intermediate_cert = |
| 714 ImportCertFromFile(certs_dir, "diginotar_public_ca_2025.pem"); | 749 ImportCertFromFile(certs_dir, "diginotar_public_ca_2025.pem"); |
| (...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1975 #define MAYBE_VerifyMixed DISABLED_VerifyMixed | 2010 #define MAYBE_VerifyMixed DISABLED_VerifyMixed |
| 1976 #else | 2011 #else |
| 1977 #define MAYBE_VerifyMixed VerifyMixed | 2012 #define MAYBE_VerifyMixed VerifyMixed |
| 1978 #endif | 2013 #endif |
| 1979 WRAPPED_INSTANTIATE_TEST_CASE_P( | 2014 WRAPPED_INSTANTIATE_TEST_CASE_P( |
| 1980 MAYBE_VerifyMixed, | 2015 MAYBE_VerifyMixed, |
| 1981 X509CertificateWeakDigestTest, | 2016 X509CertificateWeakDigestTest, |
| 1982 testing::ValuesIn(kVerifyMixedTestData)); | 2017 testing::ValuesIn(kVerifyMixedTestData)); |
| 1983 | 2018 |
| 1984 } // namespace net | 2019 } // namespace net |
| OLD | NEW |