Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1356)

Unified Diff: net/base/x509_certificate_unittest.cc

Issue 9271060: Check cert->isRoot to skip extraneous root certificates in certificate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Improve comments and add TODO for generating test certs Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/x509_certificate_nss.cc ('k') | net/data/ssl/certificates/README » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/x509_certificate_unittest.cc
===================================================================
--- net/base/x509_certificate_unittest.cc (revision 119153)
+++ net/base/x509_certificate_unittest.cc (working copy)
@@ -702,6 +702,43 @@
TestRootCerts::GetInstance()->Clear();
}
+// Test for bug 108514.
+// The certificate will expire on 2012-07-20. The test will still
+// pass if error == ERR_CERT_DATE_INVALID. TODO(rsleevi): generate test
+// certificates for this unit test. http://crbug.com/111730
+TEST(X509CertificateTest, ExtraneousMD5RootCert) {
+ FilePath certs_dir = GetTestCertsDirectory();
+
+ scoped_refptr<X509Certificate> server_cert =
+ ImportCertFromFile(certs_dir, "images_etrade_wallst_com.pem");
+ ASSERT_NE(static_cast<X509Certificate*>(NULL), server_cert);
+
+ scoped_refptr<X509Certificate> intermediate_cert =
+ ImportCertFromFile(certs_dir, "globalsign_orgv1_ca.pem");
+ ASSERT_NE(static_cast<X509Certificate*>(NULL), intermediate_cert);
+
+ scoped_refptr<X509Certificate> md5_root_cert =
+ ImportCertFromFile(certs_dir, "globalsign_root_ca_md5.pem");
+ ASSERT_NE(static_cast<X509Certificate*>(NULL), md5_root_cert);
+
+ X509Certificate::OSCertHandles intermediates;
+ intermediates.push_back(intermediate_cert->os_cert_handle());
+ intermediates.push_back(md5_root_cert->os_cert_handle());
+ scoped_refptr<X509Certificate> cert_chain =
+ X509Certificate::CreateFromHandle(server_cert->os_cert_handle(),
+ intermediates);
+
+ CertVerifyResult verify_result;
+ int flags = 0;
+ int error = cert_chain->Verify("images.etrade.wallst.com", flags, NULL,
+ &verify_result);
+ if (error != OK)
+ EXPECT_EQ(ERR_CERT_DATE_INVALID, error);
+
+ EXPECT_FALSE(verify_result.has_md5);
+ EXPECT_FALSE(verify_result.has_md5_ca);
+}
+
// Test for bug 94673.
TEST(X509CertificateTest, GoogleDigiNotarTest) {
FilePath certs_dir = GetTestCertsDirectory();
« no previous file with comments | « net/base/x509_certificate_nss.cc ('k') | net/data/ssl/certificates/README » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698