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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 EXPECT_EQ(paypal_null_fingerprint[i], fingerprint.data[i]); | 238 EXPECT_EQ(paypal_null_fingerprint[i], fingerprint.data[i]); |
239 | 239 |
240 int flags = 0; | 240 int flags = 0; |
241 CertVerifyResult verify_result; | 241 CertVerifyResult verify_result; |
242 int error = Verify(paypal_null_cert.get(), | 242 int error = Verify(paypal_null_cert.get(), |
243 "www.paypal.com", | 243 "www.paypal.com", |
244 flags, | 244 flags, |
245 NULL, | 245 NULL, |
246 empty_cert_list_, | 246 empty_cert_list_, |
247 &verify_result); | 247 &verify_result); |
248 #if defined(USE_NSS_CERTS) || defined(OS_IOS) || defined(OS_ANDROID) | 248 #if defined(USE_NSS_VERIFIER) || defined(OS_ANDROID) |
249 EXPECT_EQ(ERR_CERT_COMMON_NAME_INVALID, error); | 249 EXPECT_EQ(ERR_CERT_COMMON_NAME_INVALID, error); |
250 #else | 250 #else |
251 // TOOD(bulach): investigate why macosx and win aren't returning | 251 // TOOD(bulach): investigate why macosx and win aren't returning |
252 // ERR_CERT_INVALID or ERR_CERT_COMMON_NAME_INVALID. | 252 // ERR_CERT_INVALID or ERR_CERT_COMMON_NAME_INVALID. |
253 EXPECT_EQ(ERR_CERT_AUTHORITY_INVALID, error); | 253 EXPECT_EQ(ERR_CERT_AUTHORITY_INVALID, error); |
254 #endif | 254 #endif |
255 // Either the system crypto library should correctly report a certificate | 255 // Either the system crypto library should correctly report a certificate |
256 // name mismatch, or our certificate blacklist should cause us to report an | 256 // name mismatch, or our certificate blacklist should cause us to report an |
257 // invalid certificate. | 257 // invalid certificate. |
258 #if defined(USE_NSS_CERTS) || defined(OS_WIN) || defined(OS_IOS) | 258 #if defined(USE_NSS_VERIFIER) || defined(OS_WIN) |
259 EXPECT_TRUE(verify_result.cert_status & | 259 EXPECT_TRUE(verify_result.cert_status & |
260 (CERT_STATUS_COMMON_NAME_INVALID | CERT_STATUS_INVALID)); | 260 (CERT_STATUS_COMMON_NAME_INVALID | CERT_STATUS_INVALID)); |
261 #endif | 261 #endif |
262 } | 262 } |
263 | 263 |
264 // A regression test for http://crbug.com/31497. | 264 // A regression test for http://crbug.com/31497. |
265 #if defined(OS_ANDROID) | 265 #if defined(OS_ANDROID) |
266 // Disabled on Android, as the Android verification libraries require an | 266 // Disabled on Android, as the Android verification libraries require an |
267 // explicit policy to be specified, even when anyPolicy is permitted. | 267 // explicit policy to be specified, even when anyPolicy is permitted. |
268 #define MAYBE_IntermediateCARequireExplicitPolicy \ | 268 #define MAYBE_IntermediateCARequireExplicitPolicy \ |
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1737 int flags = 0; | 1737 int flags = 0; |
1738 CertVerifyResult verify_result; | 1738 CertVerifyResult verify_result; |
1739 int error = Verify(cert.get(), "127.0.0.1", flags, NULL, empty_cert_list_, | 1739 int error = Verify(cert.get(), "127.0.0.1", flags, NULL, empty_cert_list_, |
1740 &verify_result); | 1740 &verify_result); |
1741 EXPECT_EQ(ERR_CERT_INVALID, error); | 1741 EXPECT_EQ(ERR_CERT_INVALID, error); |
1742 EXPECT_EQ(CERT_STATUS_INVALID, verify_result.cert_status); | 1742 EXPECT_EQ(CERT_STATUS_INVALID, verify_result.cert_status); |
1743 } | 1743 } |
1744 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 1744 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
1745 | 1745 |
1746 } // namespace net | 1746 } // namespace net |
OLD | NEW |