| 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/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 verify_result.verified_cert->os_cert_handle())); | 684 verify_result.verified_cert->os_cert_handle())); |
| 685 const X509Certificate::OSCertHandles& return_intermediates = | 685 const X509Certificate::OSCertHandles& return_intermediates = |
| 686 verify_result.verified_cert->GetIntermediateCertificates(); | 686 verify_result.verified_cert->GetIntermediateCertificates(); |
| 687 ASSERT_EQ(2U, return_intermediates.size()); | 687 ASSERT_EQ(2U, return_intermediates.size()); |
| 688 EXPECT_TRUE(X509Certificate::IsSameOSCert(return_intermediates[0], | 688 EXPECT_TRUE(X509Certificate::IsSameOSCert(return_intermediates[0], |
| 689 certs[1]->os_cert_handle())); | 689 certs[1]->os_cert_handle())); |
| 690 EXPECT_TRUE(X509Certificate::IsSameOSCert(return_intermediates[1], | 690 EXPECT_TRUE(X509Certificate::IsSameOSCert(return_intermediates[1], |
| 691 certs[2]->os_cert_handle())); | 691 certs[2]->os_cert_handle())); |
| 692 } | 692 } |
| 693 | 693 |
| 694 #if defined(OS_ANDROID) |
| 695 // TODO(ppi): Disabled because is_issued_by_known_root is incorrect on Android. |
| 696 // Once this is fixed, re-enable this check for android. crbug.com/116838 |
| 697 #define MAYBE_IntranetHostsRejected DISABLED_IntranetHostsRejected |
| 698 #else |
| 699 #define MAYBE_IntranetHostsRejected IntranetHostsRejected |
| 700 #endif |
| 701 |
| 694 // Test that certificates issued for 'intranet' names (that is, containing no | 702 // Test that certificates issued for 'intranet' names (that is, containing no |
| 695 // known public registry controlled domain information) issued by well-known | 703 // known public registry controlled domain information) issued by well-known |
| 696 // CAs are flagged appropriately, while certificates that are issued by | 704 // CAs are flagged appropriately, while certificates that are issued by |
| 697 // internal CAs are not flagged. | 705 // internal CAs are not flagged. |
| 698 TEST_F(CertVerifyProcTest, IntranetHostsRejected) { | 706 TEST_F(CertVerifyProcTest, MAYBE_IntranetHostsRejected) { |
| 699 CertificateList cert_list = CreateCertificateListFromFile( | 707 CertificateList cert_list = CreateCertificateListFromFile( |
| 700 GetTestCertsDirectory(), "ok_cert.pem", | 708 GetTestCertsDirectory(), "ok_cert.pem", |
| 701 X509Certificate::FORMAT_AUTO); | 709 X509Certificate::FORMAT_AUTO); |
| 702 ASSERT_EQ(1U, cert_list.size()); | 710 ASSERT_EQ(1U, cert_list.size()); |
| 703 scoped_refptr<X509Certificate> cert(cert_list[0]); | 711 scoped_refptr<X509Certificate> cert(cert_list[0]); |
| 704 | 712 |
| 705 CertVerifyResult verify_result; | 713 CertVerifyResult verify_result; |
| 706 int error = 0; | 714 int error = 0; |
| 707 | 715 |
| 708 // Intranet names for public CAs should be flagged: | 716 // Intranet names for public CAs should be flagged: |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1414 EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_COMMON_NAME_INVALID); | 1422 EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_COMMON_NAME_INVALID); |
| 1415 } | 1423 } |
| 1416 } | 1424 } |
| 1417 | 1425 |
| 1418 WRAPPED_INSTANTIATE_TEST_CASE_P( | 1426 WRAPPED_INSTANTIATE_TEST_CASE_P( |
| 1419 VerifyName, | 1427 VerifyName, |
| 1420 CertVerifyProcNameTest, | 1428 CertVerifyProcNameTest, |
| 1421 testing::ValuesIn(kVerifyNameData)); | 1429 testing::ValuesIn(kVerifyNameData)); |
| 1422 | 1430 |
| 1423 } // namespace net | 1431 } // namespace net |
| OLD | NEW |