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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 scoped_refptr<X509Certificate> cert = | 581 scoped_refptr<X509Certificate> cert = |
582 ImportCertFromFile(certs_dir, "nist.der"); | 582 ImportCertFromFile(certs_dir, "nist.der"); |
583 ASSERT_NE(static_cast<X509Certificate*>(NULL), cert); | 583 ASSERT_NE(static_cast<X509Certificate*>(NULL), cert); |
584 | 584 |
585 std::string derBytes; | 585 std::string derBytes; |
586 EXPECT_TRUE(cert->GetDEREncoded(&derBytes)); | 586 EXPECT_TRUE(cert->GetDEREncoded(&derBytes)); |
587 | 587 |
588 std::vector<base::StringPiece> crl_urls; | 588 std::vector<base::StringPiece> crl_urls; |
589 EXPECT_TRUE(asn1::ExtractCRLURLsFromDERCert(derBytes, &crl_urls)); | 589 EXPECT_TRUE(asn1::ExtractCRLURLsFromDERCert(derBytes, &crl_urls)); |
590 | 590 |
591 EXPECT_EQ(crl_urls.size(), 1u); | 591 EXPECT_EQ(1u, crl_urls.size()); |
592 if (crl_urls.size() > 0) { | 592 if (crl_urls.size() > 0) { |
593 EXPECT_EQ(crl_urls[0].as_string(), | 593 EXPECT_EQ("http://SVRSecure-G3-crl.verisign.com/SVRSecureG3.crl", |
594 "http://SVRSecure-G3-crl.verisign.com/SVRSecureG3.crl"); | 594 crl_urls[0].as_string()); |
595 } | 595 } |
596 } | 596 } |
597 | 597 |
598 TEST(X509CertificateTest, PublicKeyHashes) { | 598 TEST(X509CertificateTest, PublicKeyHashes) { |
599 FilePath certs_dir = GetTestCertsDirectory(); | 599 FilePath certs_dir = GetTestCertsDirectory(); |
600 // This is going to blow up in Feb 2012. Sorry! Disable and file a bug | 600 // This is going to blow up in Feb 2012. Sorry! Disable and file a bug |
601 // against agl. Also see TestKnownRoot in this file. | 601 // against agl. Also see TestKnownRoot in this file. |
602 scoped_refptr<X509Certificate> cert = | 602 scoped_refptr<X509Certificate> cert = |
603 ImportCertFromFile(certs_dir, "nist.der"); | 603 ImportCertFromFile(certs_dir, "nist.der"); |
604 ASSERT_NE(static_cast<X509Certificate*>(NULL), cert); | 604 ASSERT_NE(static_cast<X509Certificate*>(NULL), cert); |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 EXPECT_EQ(test_data.expected, | 1168 EXPECT_EQ(test_data.expected, |
1169 X509Certificate::VerifyHostname(test_data.hostname, cert_names)) | 1169 X509Certificate::VerifyHostname(test_data.hostname, cert_names)) |
1170 << "Host [" << test_data.hostname | 1170 << "Host [" << test_data.hostname |
1171 << "], cert name [" << test_data.cert_names << "]"; | 1171 << "], cert name [" << test_data.cert_names << "]"; |
1172 } | 1172 } |
1173 | 1173 |
1174 INSTANTIATE_TEST_CASE_P(, X509CertificateNameVerifyTest, | 1174 INSTANTIATE_TEST_CASE_P(, X509CertificateNameVerifyTest, |
1175 testing::ValuesIn(kNameVerifyTestData)); | 1175 testing::ValuesIn(kNameVerifyTestData)); |
1176 | 1176 |
1177 } // namespace net | 1177 } // namespace net |
OLD | NEW |