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/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 Loading... |
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 Loading... |
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 |
OLD | NEW |