| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 EXPECT_TRUE(memcmp(google_cert->serial_number().data(), google_serial, | 422 EXPECT_TRUE(memcmp(google_cert->serial_number().data(), google_serial, |
| 423 sizeof(google_serial)) == 0); | 423 sizeof(google_serial)) == 0); |
| 424 | 424 |
| 425 // We also want to check a serial number where the first byte is >= 0x80 in | 425 // We also want to check a serial number where the first byte is >= 0x80 in |
| 426 // case the underlying library tries to pad it. | 426 // case the underlying library tries to pad it. |
| 427 scoped_refptr<X509Certificate> paypal_null_cert( | 427 scoped_refptr<X509Certificate> paypal_null_cert( |
| 428 X509Certificate::CreateFromBytes( | 428 X509Certificate::CreateFromBytes( |
| 429 reinterpret_cast<const char*>(paypal_null_der), | 429 reinterpret_cast<const char*>(paypal_null_der), |
| 430 sizeof(paypal_null_der))); | 430 sizeof(paypal_null_der))); |
| 431 | 431 |
| 432 static const uint8 paypal_null_serial[2] = {0xf0, 0x9b}; | 432 static const uint8 paypal_null_serial[3] = {0x00, 0xf0, 0x9b}; |
| 433 ASSERT_EQ(sizeof(paypal_null_serial), | 433 ASSERT_EQ(sizeof(paypal_null_serial), |
| 434 paypal_null_cert->serial_number().size()); | 434 paypal_null_cert->serial_number().size()); |
| 435 EXPECT_TRUE(memcmp(paypal_null_cert->serial_number().data(), | 435 EXPECT_TRUE(memcmp(paypal_null_cert->serial_number().data(), |
| 436 paypal_null_serial, sizeof(paypal_null_serial)) == 0); | 436 paypal_null_serial, sizeof(paypal_null_serial)) == 0); |
| 437 } | 437 } |
| 438 | 438 |
| 439 // A regression test for http://crbug.com/31497. | 439 // A regression test for http://crbug.com/31497. |
| 440 // This certificate will expire on 2012-04-08. | 440 // This certificate will expire on 2012-04-08. |
| 441 TEST(X509CertificateTest, IntermediateCARequireExplicitPolicy) { | 441 TEST(X509CertificateTest, IntermediateCARequireExplicitPolicy) { |
| 442 FilePath certs_dir = GetTestCertsDirectory(); | 442 FilePath certs_dir = GetTestCertsDirectory(); |
| (...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1454 } | 1454 } |
| 1455 | 1455 |
| 1456 EXPECT_EQ(test_data.expected, X509Certificate::VerifyHostname( | 1456 EXPECT_EQ(test_data.expected, X509Certificate::VerifyHostname( |
| 1457 test_data.hostname, common_name, dns_names, ip_addressses)); | 1457 test_data.hostname, common_name, dns_names, ip_addressses)); |
| 1458 } | 1458 } |
| 1459 | 1459 |
| 1460 INSTANTIATE_TEST_CASE_P(, X509CertificateNameVerifyTest, | 1460 INSTANTIATE_TEST_CASE_P(, X509CertificateNameVerifyTest, |
| 1461 testing::ValuesIn(kNameVerifyTestData)); | 1461 testing::ValuesIn(kNameVerifyTestData)); |
| 1462 | 1462 |
| 1463 } // namespace net | 1463 } // namespace net |
| OLD | NEW |