| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ssl/ssl_platform_key_mac.h" | 5 #include "net/ssl/ssl_platform_key_mac.h" |
| 6 | 6 |
| 7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
| 8 #include <Security/SecCertificate.h> | 8 #include <Security/SecCertificate.h> |
| 9 #include <Security/SecImportExport.h> | 9 #include <Security/SecImportExport.h> |
| 10 #include <Security/SecKeychain.h> | 10 #include <Security/SecKeychain.h> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "third_party/boringssl/src/include/openssl/ec_key.h" | 26 #include "third_party/boringssl/src/include/openssl/ec_key.h" |
| 27 #include "third_party/boringssl/src/include/openssl/evp.h" | 27 #include "third_party/boringssl/src/include/openssl/evp.h" |
| 28 #include "third_party/boringssl/src/include/openssl/mem.h" | 28 #include "third_party/boringssl/src/include/openssl/mem.h" |
| 29 #include "third_party/boringssl/src/include/openssl/rsa.h" | 29 #include "third_party/boringssl/src/include/openssl/rsa.h" |
| 30 | 30 |
| 31 namespace net { | 31 namespace net { |
| 32 | 32 |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 struct TestKey { | 35 struct TestKey { |
| 36 const char* name; |
| 36 const char* cert_file; | 37 const char* cert_file; |
| 37 const char* key_file; | 38 const char* key_file; |
| 38 SSLPrivateKey::Type key_type; | |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 const TestKey kTestKeys[] = { | 41 const TestKey kTestKeys[] = { |
| 42 {"client_1.pem", "client_1.pk8", SSLPrivateKey::Type::RSA}, | 42 {"RSA", "client_1.pem", "client_1.pk8"}, |
| 43 {"client_4.pem", "client_4.pk8", SSLPrivateKey::Type::ECDSA_P256}, | 43 {"ECDSA_P256", "client_4.pem", "client_4.pk8"}, |
| 44 {"client_5.pem", "client_5.pk8", SSLPrivateKey::Type::ECDSA_P384}, | 44 {"ECDSA_P384", "client_5.pem", "client_5.pk8"}, |
| 45 {"client_6.pem", "client_6.pk8", SSLPrivateKey::Type::ECDSA_P521}, | 45 {"ECDSA_P521", "client_6.pem", "client_6.pk8"}, |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 std::string TestKeyToString(const testing::TestParamInfo<TestKey>& params) { | 48 std::string TestKeyToString(const testing::TestParamInfo<TestKey>& params) { |
| 49 return SSLPrivateKeyTypeToString(params.param.key_type); | 49 return params.param.name; |
| 50 } | 50 } |
| 51 | 51 |
| 52 } // namespace | 52 } // namespace |
| 53 | 53 |
| 54 class SSLPlatformKeyMacTest : public testing::TestWithParam<TestKey> {}; | 54 class SSLPlatformKeyMacTest : public testing::TestWithParam<TestKey> {}; |
| 55 | 55 |
| 56 TEST_P(SSLPlatformKeyMacTest, KeyMatches) { | 56 TEST_P(SSLPlatformKeyMacTest, KeyMatches) { |
| 57 const TestKey& test_key = GetParam(); | 57 const TestKey& test_key = GetParam(); |
| 58 | 58 |
| 59 // Load test data. | 59 // Load test data. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 131 |
| 132 TestSSLPrivateKeyMatches(key.get(), pkcs8); | 132 TestSSLPrivateKeyMatches(key.get(), pkcs8); |
| 133 } | 133 } |
| 134 | 134 |
| 135 INSTANTIATE_TEST_CASE_P(, | 135 INSTANTIATE_TEST_CASE_P(, |
| 136 SSLPlatformKeyMacTest, | 136 SSLPlatformKeyMacTest, |
| 137 testing::ValuesIn(kTestKeys), | 137 testing::ValuesIn(kTestKeys), |
| 138 TestKeyToString); | 138 TestKeyToString); |
| 139 | 139 |
| 140 } // namespace net | 140 } // namespace net |
| OLD | NEW |