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

Side by Side Diff: net/cert/x509_certificate_unittest.cc

Issue 1094983002: Account for the OS returning an empty certificate chain. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: size test cert to a multiple of 8, otherwise key size in bits is weird Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « net/cert/x509_certificate_mac.cc ('k') | net/data/ssl/certificates/large_key.pem » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/x509_certificate.h" 5 #include "net/cert/x509_certificate.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 } 1151 }
1152 1152
1153 INSTANTIATE_TEST_CASE_P(, X509CertificateNameVerifyTest, 1153 INSTANTIATE_TEST_CASE_P(, X509CertificateNameVerifyTest,
1154 testing::ValuesIn(kNameVerifyTestData)); 1154 testing::ValuesIn(kNameVerifyTestData));
1155 1155
1156 const struct PublicKeyInfoTestData { 1156 const struct PublicKeyInfoTestData {
1157 const char* cert_file; 1157 const char* cert_file;
1158 size_t expected_bits; 1158 size_t expected_bits;
1159 X509Certificate::PublicKeyType expected_type; 1159 X509Certificate::PublicKeyType expected_type;
1160 } kPublicKeyInfoTestData[] = { 1160 } kPublicKeyInfoTestData[] = {
1161 { "768-rsa-ee-by-768-rsa-intermediate.pem", 768, 1161 {"768-rsa-ee-by-768-rsa-intermediate.pem",
1162 X509Certificate::kPublicKeyTypeRSA }, 1162 768,
1163 { "1024-rsa-ee-by-768-rsa-intermediate.pem", 1024, 1163 X509Certificate::kPublicKeyTypeRSA},
1164 X509Certificate::kPublicKeyTypeRSA }, 1164 {"1024-rsa-ee-by-768-rsa-intermediate.pem",
1165 { "prime256v1-ecdsa-ee-by-1024-rsa-intermediate.pem", 256, 1165 1024,
1166 X509Certificate::kPublicKeyTypeECDSA }, 1166 X509Certificate::kPublicKeyTypeRSA},
1167 {"prime256v1-ecdsa-ee-by-1024-rsa-intermediate.pem",
1168 256,
1169 X509Certificate::kPublicKeyTypeECDSA},
1170 #if defined(OS_MACOSX) && !defined(OS_IOS)
1171 // OS X has an key length limit of 4096 bits. This should manifest as an
1172 // unknown key. If a future version of OS X changes this, large_key.pem may
1173 // need to be renegerated with a larger key. See https://crbug.com/472291.
1174 {"large_key.pem", 0, X509Certificate::kPublicKeyTypeUnknown},
1175 #else
1176 {"large_key.pem", 4104, X509Certificate::kPublicKeyTypeRSA},
1177 #endif
1167 }; 1178 };
1168 1179
1169 class X509CertificatePublicKeyInfoTest 1180 class X509CertificatePublicKeyInfoTest
1170 : public testing::TestWithParam<PublicKeyInfoTestData> { 1181 : public testing::TestWithParam<PublicKeyInfoTestData> {
1171 }; 1182 };
1172 1183
1173 TEST_P(X509CertificatePublicKeyInfoTest, GetPublicKeyInfo) { 1184 TEST_P(X509CertificatePublicKeyInfoTest, GetPublicKeyInfo) {
1174 PublicKeyInfoTestData data = GetParam(); 1185 PublicKeyInfoTestData data = GetParam();
1175 1186
1176 #if defined(OS_WIN) 1187 #if defined(OS_WIN)
(...skipping 16 matching lines...) Expand all
1193 &actual_type); 1204 &actual_type);
1194 1205
1195 EXPECT_EQ(data.expected_bits, actual_bits); 1206 EXPECT_EQ(data.expected_bits, actual_bits);
1196 EXPECT_EQ(data.expected_type, actual_type); 1207 EXPECT_EQ(data.expected_type, actual_type);
1197 } 1208 }
1198 1209
1199 INSTANTIATE_TEST_CASE_P(, X509CertificatePublicKeyInfoTest, 1210 INSTANTIATE_TEST_CASE_P(, X509CertificatePublicKeyInfoTest,
1200 testing::ValuesIn(kPublicKeyInfoTestData)); 1211 testing::ValuesIn(kPublicKeyInfoTestData));
1201 1212
1202 } // namespace net 1213 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/x509_certificate_mac.cc ('k') | net/data/ssl/certificates/large_key.pem » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698