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 "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" |
| 11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/sha1.h" | 14 #include "base/sha1.h" |
| 15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 16 #include "build/build_config.h" | |
| 16 #include "crypto/sha2.h" | 17 #include "crypto/sha2.h" |
| 17 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 18 #include "net/base/test_data_directory.h" | 19 #include "net/base/test_data_directory.h" |
| 19 #include "net/cert/asn1_util.h" | 20 #include "net/cert/asn1_util.h" |
| 20 #include "net/cert/cert_status_flags.h" | 21 #include "net/cert/cert_status_flags.h" |
| 21 #include "net/cert/cert_verifier.h" | 22 #include "net/cert/cert_verifier.h" |
| 22 #include "net/cert/cert_verify_result.h" | 23 #include "net/cert/cert_verify_result.h" |
| 23 #include "net/cert/crl_set.h" | 24 #include "net/cert/crl_set.h" |
| 24 #include "net/cert/crl_set_storage.h" | 25 #include "net/cert/crl_set_storage.h" |
| 25 #include "net/cert/test_root_certs.h" | 26 #include "net/cert/test_root_certs.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 int error = Verify(comodo_chain.get(), | 197 int error = Verify(comodo_chain.get(), |
| 197 "comodo.com", | 198 "comodo.com", |
| 198 flags, | 199 flags, |
| 199 crl_set.get(), | 200 crl_set.get(), |
| 200 empty_cert_list_, | 201 empty_cert_list_, |
| 201 &verify_result); | 202 &verify_result); |
| 202 EXPECT_EQ(OK, error); | 203 EXPECT_EQ(OK, error); |
| 203 EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_IS_EV); | 204 EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_IS_EV); |
| 204 } | 205 } |
| 205 | 206 |
| 206 TEST_F(CertVerifyProcTest, PaypalNullCertParsing) { | 207 // TODO(crbug.com/605457): this test is disabled on iOS as it should check |
| 208 // that the certificate has encoding issue but does not currently test it. | |
| 209 #if !defined(OS_IOS) | |
|
Ryan Sleevi
2016/04/21 11:29:21
As explained in the previous CL (but perhaps uncle
sdefresne
2016/04/21 13:04:20
I've removed line 242-246 and changed the conditio
| |
| 210 #define MAYBE_PaypalNullCertParsing PaypalNullCertParsing | |
| 211 #else | |
| 212 #define MAYBE_PaypalNullCertParsing DISABLED_PaypalNullCertParsing | |
| 213 #endif | |
| 214 | |
| 215 TEST_F(CertVerifyProcTest, MAYBE_PaypalNullCertParsing) { | |
| 207 scoped_refptr<X509Certificate> paypal_null_cert( | 216 scoped_refptr<X509Certificate> paypal_null_cert( |
| 208 X509Certificate::CreateFromBytes( | 217 X509Certificate::CreateFromBytes( |
| 209 reinterpret_cast<const char*>(paypal_null_der), | 218 reinterpret_cast<const char*>(paypal_null_der), |
| 210 sizeof(paypal_null_der))); | 219 sizeof(paypal_null_der))); |
| 211 | 220 |
| 212 ASSERT_NE(static_cast<X509Certificate*>(NULL), paypal_null_cert.get()); | 221 ASSERT_NE(static_cast<X509Certificate*>(NULL), paypal_null_cert.get()); |
| 213 | 222 |
| 214 const SHA1HashValue& fingerprint = | 223 const SHA1HashValue& fingerprint = |
| 215 paypal_null_cert->fingerprint(); | 224 paypal_null_cert->fingerprint(); |
| 216 for (size_t i = 0; i < 20; ++i) | 225 for (size_t i = 0; i < 20; ++i) |
| (...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1702 int flags = 0; | 1711 int flags = 0; |
| 1703 CertVerifyResult verify_result; | 1712 CertVerifyResult verify_result; |
| 1704 int error = Verify(cert.get(), "127.0.0.1", flags, NULL, empty_cert_list_, | 1713 int error = Verify(cert.get(), "127.0.0.1", flags, NULL, empty_cert_list_, |
| 1705 &verify_result); | 1714 &verify_result); |
| 1706 EXPECT_EQ(ERR_CERT_INVALID, error); | 1715 EXPECT_EQ(ERR_CERT_INVALID, error); |
| 1707 EXPECT_EQ(CERT_STATUS_INVALID, verify_result.cert_status); | 1716 EXPECT_EQ(CERT_STATUS_INVALID, verify_result.cert_status); |
| 1708 } | 1717 } |
| 1709 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 1718 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 1710 | 1719 |
| 1711 } // namespace net | 1720 } // namespace net |
| OLD | NEW |