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 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 EXPECT_EQ(ERR_CERT_COMMON_NAME_INVALID, error); | 1586 EXPECT_EQ(ERR_CERT_COMMON_NAME_INVALID, error); |
1587 EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_COMMON_NAME_INVALID); | 1587 EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_COMMON_NAME_INVALID); |
1588 } | 1588 } |
1589 } | 1589 } |
1590 | 1590 |
1591 WRAPPED_INSTANTIATE_TEST_CASE_P( | 1591 WRAPPED_INSTANTIATE_TEST_CASE_P( |
1592 VerifyName, | 1592 VerifyName, |
1593 CertVerifyProcNameTest, | 1593 CertVerifyProcNameTest, |
1594 testing::ValuesIn(kVerifyNameData)); | 1594 testing::ValuesIn(kVerifyNameData)); |
1595 | 1595 |
| 1596 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 1597 // Test that CertVerifyProcMac reacts appropriately when Apple's certificate |
| 1598 // verifier rejects a certificate with a fatal error. This is a regression |
| 1599 // test for https://crbug.com/472291. |
| 1600 TEST_F(CertVerifyProcTest, LargeKey) { |
| 1601 // Load root_ca_cert.pem into the test root store. |
| 1602 ScopedTestRoot test_root( |
| 1603 ImportCertFromFile(GetTestCertsDirectory(), "root_ca_cert.pem").get()); |
| 1604 |
| 1605 scoped_refptr<X509Certificate> cert( |
| 1606 ImportCertFromFile(GetTestCertsDirectory(), "large_key.pem")); |
| 1607 |
| 1608 // Apple's verifier rejects this certificate as invalid because the |
| 1609 // RSA key is too large. If a future version of OS X changes this, |
| 1610 // large_key.pem may need to be regenerated with a larger key. |
| 1611 int flags = 0; |
| 1612 CertVerifyResult verify_result; |
| 1613 int error = Verify(cert.get(), "127.0.0.1", flags, NULL, empty_cert_list_, |
| 1614 &verify_result); |
| 1615 EXPECT_EQ(ERR_CERT_INVALID, error); |
| 1616 EXPECT_EQ(CERT_STATUS_INVALID, verify_result.cert_status); |
| 1617 } |
| 1618 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 1619 |
1596 } // namespace net | 1620 } // namespace net |
OLD | NEW |