OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef NET_SSL_OPENSSL_CLIENT_KEY_STORE_H_ | 5 #ifndef NET_SSL_OPENSSL_CLIENT_KEY_STORE_H_ |
6 #define NET_SSL_OPENSSL_CLIENT_KEY_STORE_H_ | 6 #define NET_SSL_OPENSSL_CLIENT_KEY_STORE_H_ |
7 | 7 |
8 #include <openssl/evp.h> | 8 #include <openssl/evp.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
15 #include "crypto/openssl_util.h" | 15 #include "crypto/openssl_util.h" |
16 #include "net/base/net_export.h" | 16 #include "net/base/net_export.h" |
17 | 17 |
18 namespace net { | 18 namespace net { |
19 | 19 |
20 class X509Certificate; | 20 class X509Certificate; |
21 | 21 |
22 // OpenSSLClientKeyStore implements an in-memory store for client | 22 // OpenSSLClientKeyStore implements an in-memory store for client |
23 // certificate private keys, because the platforms where OpenSSL is | 23 // certificate private keys, because the platforms where OpenSSL is |
24 // used do not provide a way to retrieve the private key of a known | 24 // used do not provide a way to retrieve the private key of a known |
25 // certificate. | 25 // certificate. |
26 // | 26 // |
27 // This class is not thread-safe and should only be used from the network | 27 // This class is not thread-safe and should only be used from the network |
28 // thread. | 28 // thread. |
29 class OpenSSLClientKeyStore { | 29 class NET_EXPORT OpenSSLClientKeyStore { |
30 public: | 30 public: |
31 // Platforms must define this factory function as appropriate. | 31 // Platforms must define this factory function as appropriate. |
32 static OpenSSLClientKeyStore* GetInstance(); | 32 static OpenSSLClientKeyStore* GetInstance(); |
33 | 33 |
34 struct EVP_PKEY_Deleter { | 34 struct EVP_PKEY_Deleter { |
35 inline void operator()(EVP_PKEY* ptr) const { | 35 inline void operator()(EVP_PKEY* ptr) const { |
36 EVP_PKEY_free(ptr); | 36 EVP_PKEY_free(ptr); |
37 } | 37 } |
38 }; | 38 }; |
39 | 39 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 std::vector<KeyPair> pairs_; | 99 std::vector<KeyPair> pairs_; |
100 | 100 |
101 friend struct DefaultSingletonTraits<OpenSSLClientKeyStore>; | 101 friend struct DefaultSingletonTraits<OpenSSLClientKeyStore>; |
102 | 102 |
103 DISALLOW_COPY_AND_ASSIGN(OpenSSLClientKeyStore); | 103 DISALLOW_COPY_AND_ASSIGN(OpenSSLClientKeyStore); |
104 }; | 104 }; |
105 | 105 |
106 } // namespace net | 106 } // namespace net |
107 | 107 |
108 #endif // NET_SSL_OPENSSL_CLIENT_KEY_STORE_H_ | 108 #endif // NET_SSL_OPENSSL_CLIENT_KEY_STORE_H_ |
OLD | NEW |