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

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

Issue 2746103003: Add X509CertificateBytes which uses CRYPTO_BUFFER instead of macOS-native certificate types. (Closed)
Patch Set: . Created 3 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
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 } 1194 }
1195 1195
1196 INSTANTIATE_TEST_CASE_P(, X509CertificateNameVerifyTest, 1196 INSTANTIATE_TEST_CASE_P(, X509CertificateNameVerifyTest,
1197 testing::ValuesIn(kNameVerifyTestData)); 1197 testing::ValuesIn(kNameVerifyTestData));
1198 1198
1199 const struct PublicKeyInfoTestData { 1199 const struct PublicKeyInfoTestData {
1200 const char* cert_file; 1200 const char* cert_file;
1201 size_t expected_bits; 1201 size_t expected_bits;
1202 X509Certificate::PublicKeyType expected_type; 1202 X509Certificate::PublicKeyType expected_type;
1203 } kPublicKeyInfoTestData[] = { 1203 } kPublicKeyInfoTestData[] = {
1204 {"768-rsa-ee-by-768-rsa-intermediate.pem", 1204 {"768-rsa-ee-by-768-rsa-intermediate.pem", 768,
1205 768,
1206 X509Certificate::kPublicKeyTypeRSA}, 1205 X509Certificate::kPublicKeyTypeRSA},
1207 {"1024-rsa-ee-by-768-rsa-intermediate.pem", 1206 {"1024-rsa-ee-by-768-rsa-intermediate.pem", 1024,
1208 1024,
1209 X509Certificate::kPublicKeyTypeRSA}, 1207 X509Certificate::kPublicKeyTypeRSA},
1210 {"prime256v1-ecdsa-ee-by-1024-rsa-intermediate.pem", 1208 {"prime256v1-ecdsa-ee-by-1024-rsa-intermediate.pem", 256,
1211 256,
1212 X509Certificate::kPublicKeyTypeECDSA}, 1209 X509Certificate::kPublicKeyTypeECDSA},
1213 #if defined(OS_MACOSX) && !defined(OS_IOS) 1210 #if defined(OS_MACOSX) && !defined(OS_IOS) && !defined(USE_BYTE_CERTS)
1214 // OS X has an key length limit of 4096 bits. This should manifest as an 1211 // OS X has an key length limit of 4096 bits. This should manifest as an
1215 // unknown key. If a future version of OS X changes this, large_key.pem may 1212 // unknown key. If a future version of OS X changes this, large_key.pem may
1216 // need to be renegerated with a larger key. See https://crbug.com/472291. 1213 // need to be renegerated with a larger key. See https://crbug.com/472291.
1217 {"large_key.pem", 0, X509Certificate::kPublicKeyTypeUnknown}, 1214 {"large_key.pem", 0, X509Certificate::kPublicKeyTypeUnknown},
1218 #else 1215 #else
1219 {"large_key.pem", 8200, X509Certificate::kPublicKeyTypeRSA}, 1216 {"large_key.pem", 8200, X509Certificate::kPublicKeyTypeRSA},
1220 #endif 1217 #endif
1221 }; 1218 };
1222 1219
1223 class X509CertificatePublicKeyInfoTest 1220 class X509CertificatePublicKeyInfoTest
(...skipping 15 matching lines...) Expand all
1239 &actual_type); 1236 &actual_type);
1240 1237
1241 EXPECT_EQ(data.expected_bits, actual_bits); 1238 EXPECT_EQ(data.expected_bits, actual_bits);
1242 EXPECT_EQ(data.expected_type, actual_type); 1239 EXPECT_EQ(data.expected_type, actual_type);
1243 } 1240 }
1244 1241
1245 INSTANTIATE_TEST_CASE_P(, X509CertificatePublicKeyInfoTest, 1242 INSTANTIATE_TEST_CASE_P(, X509CertificatePublicKeyInfoTest,
1246 testing::ValuesIn(kPublicKeyInfoTestData)); 1243 testing::ValuesIn(kPublicKeyInfoTestData));
1247 1244
1248 } // namespace net 1245 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698