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/test_ssl_private_key.h" | 5 #include "net/ssl/test_ssl_private_key.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "crypto/rsa_private_key.h" |
12 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
13 #include "net/ssl/ssl_platform_key_util.h" | 14 #include "net/ssl/ssl_platform_key_util.h" |
14 #include "net/ssl/ssl_private_key.h" | 15 #include "net/ssl/ssl_private_key.h" |
15 #include "net/ssl/threaded_ssl_private_key.h" | 16 #include "net/ssl/threaded_ssl_private_key.h" |
16 #include "third_party/boringssl/src/include/openssl/digest.h" | 17 #include "third_party/boringssl/src/include/openssl/digest.h" |
17 #include "third_party/boringssl/src/include/openssl/ec.h" | 18 #include "third_party/boringssl/src/include/openssl/ec.h" |
18 #include "third_party/boringssl/src/include/openssl/evp.h" | 19 #include "third_party/boringssl/src/include/openssl/evp.h" |
19 #include "third_party/boringssl/src/include/openssl/rsa.h" | 20 #include "third_party/boringssl/src/include/openssl/rsa.h" |
20 | 21 |
21 namespace net { | 22 namespace net { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 scoped_refptr<SSLPrivateKey> WrapOpenSSLPrivateKey( | 102 scoped_refptr<SSLPrivateKey> WrapOpenSSLPrivateKey( |
102 bssl::UniquePtr<EVP_PKEY> key) { | 103 bssl::UniquePtr<EVP_PKEY> key) { |
103 if (!key) | 104 if (!key) |
104 return nullptr; | 105 return nullptr; |
105 | 106 |
106 return make_scoped_refptr(new ThreadedSSLPrivateKey( | 107 return make_scoped_refptr(new ThreadedSSLPrivateKey( |
107 base::MakeUnique<TestSSLPlatformKey>(std::move(key)), | 108 base::MakeUnique<TestSSLPlatformKey>(std::move(key)), |
108 GetSSLPlatformKeyTaskRunner())); | 109 GetSSLPlatformKeyTaskRunner())); |
109 } | 110 } |
110 | 111 |
| 112 scoped_refptr<SSLPrivateKey> WrapRSAPrivateKey( |
| 113 crypto::RSAPrivateKey* rsa_private_key) { |
| 114 EVP_PKEY_up_ref(rsa_private_key->key()); |
| 115 return net::WrapOpenSSLPrivateKey( |
| 116 bssl::UniquePtr<EVP_PKEY>(rsa_private_key->key())); |
| 117 } |
| 118 |
111 } // namespace net | 119 } // namespace net |
OLD | NEW |