| 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_util.h" | 5 #include "net/ssl/ssl_platform_key_util.h" |
| 6 | 6 |
| 7 #include <openssl/ecdsa.h> | |
| 8 #include <stddef.h> | 7 #include <stddef.h> |
| 9 | 8 |
| 10 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 11 #include "net/cert/x509_certificate.h" | 10 #include "net/cert/x509_certificate.h" |
| 12 #include "net/ssl/ssl_private_key.h" | 11 #include "net/ssl/ssl_private_key.h" |
| 13 #include "net/test/cert_test_util.h" | 12 #include "net/test/cert_test_util.h" |
| 14 #include "net/test/test_data_directory.h" | 13 #include "net/test/test_data_directory.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "third_party/boringssl/src/include/openssl/ecdsa.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 bool GetClientCertInfoFromFile(const char* filename, | 21 bool GetClientCertInfoFromFile(const char* filename, |
| 22 SSLPrivateKey::Type* out_type, | 22 SSLPrivateKey::Type* out_type, |
| 23 size_t* out_max_length) { | 23 size_t* out_max_length) { |
| 24 scoped_refptr<X509Certificate> cert = | 24 scoped_refptr<X509Certificate> cert = |
| 25 ImportCertFromFile(GetTestCertsDirectory(), filename); | 25 ImportCertFromFile(GetTestCertsDirectory(), filename); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 40 ASSERT_TRUE(GetClientCertInfoFromFile("client_1.pem", &type, &max_length)); | 40 ASSERT_TRUE(GetClientCertInfoFromFile("client_1.pem", &type, &max_length)); |
| 41 EXPECT_EQ(SSLPrivateKey::Type::RSA, type); | 41 EXPECT_EQ(SSLPrivateKey::Type::RSA, type); |
| 42 EXPECT_EQ(2048u / 8u, max_length); | 42 EXPECT_EQ(2048u / 8u, max_length); |
| 43 | 43 |
| 44 ASSERT_TRUE(GetClientCertInfoFromFile("client_4.pem", &type, &max_length)); | 44 ASSERT_TRUE(GetClientCertInfoFromFile("client_4.pem", &type, &max_length)); |
| 45 EXPECT_EQ(SSLPrivateKey::Type::ECDSA_P256, type); | 45 EXPECT_EQ(SSLPrivateKey::Type::ECDSA_P256, type); |
| 46 EXPECT_EQ(ECDSA_SIG_max_len(256u / 8u), max_length); | 46 EXPECT_EQ(ECDSA_SIG_max_len(256u / 8u), max_length); |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace net | 49 } // namespace net |
| OLD | NEW |