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> |
(...skipping 14 matching lines...) Expand all Loading... |
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 NET_EXPORT 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 { EVP_PKEY_free(ptr); } |
36 EVP_PKEY_free(ptr); | |
37 } | |
38 }; | 36 }; |
39 | 37 |
40 typedef scoped_ptr<EVP_PKEY, EVP_PKEY_Deleter> ScopedEVP_PKEY; | 38 typedef scoped_ptr<EVP_PKEY, EVP_PKEY_Deleter> ScopedEVP_PKEY; |
41 | 39 |
42 // Record the association between a certificate and its | 40 // Record the association between a certificate and its |
43 // private key. This method should be called _before_ | 41 // private key. This method should be called _before_ |
44 // FetchClientCertPrivateKey to ensure that the private key is returned | 42 // FetchClientCertPrivateKey to ensure that the private key is returned |
45 // when it is called later. The association is recorded in memory | 43 // when it is called later. The association is recorded in memory |
46 // exclusively. | 44 // exclusively. |
47 // |cert| is a handle to a certificate object. | 45 // |cert| is a handle to a certificate object. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 std::vector<KeyPair> pairs_; | 97 std::vector<KeyPair> pairs_; |
100 | 98 |
101 friend struct DefaultSingletonTraits<OpenSSLClientKeyStore>; | 99 friend struct DefaultSingletonTraits<OpenSSLClientKeyStore>; |
102 | 100 |
103 DISALLOW_COPY_AND_ASSIGN(OpenSSLClientKeyStore); | 101 DISALLOW_COPY_AND_ASSIGN(OpenSSLClientKeyStore); |
104 }; | 102 }; |
105 | 103 |
106 } // namespace net | 104 } // namespace net |
107 | 105 |
108 #endif // NET_SSL_OPENSSL_CLIENT_KEY_STORE_H_ | 106 #endif // NET_SSL_OPENSSL_CLIENT_KEY_STORE_H_ |
OLD | NEW |