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 25 matching lines...) Expand all Loading... |
36 // private key. This method should be called _before_ | 36 // private key. This method should be called _before_ |
37 // FetchClientCertPrivateKey to ensure that the private key is returned | 37 // FetchClientCertPrivateKey to ensure that the private key is returned |
38 // when it is called later. The association is recorded in memory | 38 // when it is called later. The association is recorded in memory |
39 // exclusively. | 39 // exclusively. |
40 // |cert| is a handle to a certificate object. | 40 // |cert| is a handle to a certificate object. |
41 // |private_key| is an OpenSSL EVP_PKEY that corresponds to the | 41 // |private_key| is an OpenSSL EVP_PKEY that corresponds to the |
42 // certificate's private key. | 42 // certificate's private key. |
43 // Returns false if an error occured. | 43 // Returns false if an error occured. |
44 // This function does not take ownership of the private_key, but may | 44 // This function does not take ownership of the private_key, but may |
45 // increment its internal reference count. | 45 // increment its internal reference count. |
46 NET_EXPORT bool RecordClientCertPrivateKey(const X509Certificate* cert, | 46 bool RecordClientCertPrivateKey(const X509Certificate* cert, |
47 EVP_PKEY* private_key); | 47 EVP_PKEY* private_key); |
48 | 48 |
49 // Given a certificate's |public_key|, return the corresponding private | 49 // Given a certificate's |public_key|, return the corresponding private |
50 // key that has been recorded previously by RecordClientCertPrivateKey(). | 50 // key that has been recorded previously by RecordClientCertPrivateKey(). |
51 // |cert| is a client certificate. | 51 // |cert| is a client certificate. |
52 // Returns its matching private key on success, NULL otherwise. | 52 // Returns its matching private key on success, NULL otherwise. |
53 crypto::ScopedEVP_PKEY FetchClientCertPrivateKey(const X509Certificate* cert); | 53 crypto::ScopedEVP_PKEY FetchClientCertPrivateKey(const X509Certificate* cert); |
54 | 54 |
55 // Flush all recorded keys. | 55 // Flush all recorded keys. |
56 void Flush(); | 56 void Flush(); |
57 | 57 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 std::vector<KeyPair> pairs_; | 91 std::vector<KeyPair> pairs_; |
92 | 92 |
93 friend struct DefaultSingletonTraits<OpenSSLClientKeyStore>; | 93 friend struct DefaultSingletonTraits<OpenSSLClientKeyStore>; |
94 | 94 |
95 DISALLOW_COPY_AND_ASSIGN(OpenSSLClientKeyStore); | 95 DISALLOW_COPY_AND_ASSIGN(OpenSSLClientKeyStore); |
96 }; | 96 }; |
97 | 97 |
98 } // namespace net | 98 } // namespace net |
99 | 99 |
100 #endif // NET_SSL_OPENSSL_CLIENT_KEY_STORE_H_ | 100 #endif // NET_SSL_OPENSSL_CLIENT_KEY_STORE_H_ |
OLD | NEW |