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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 NET_EXPORT 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 // |*private_key| will be reset to its matching private key on success. | 52 // Returns its matching private key on success, NULL otherwise. |
53 // Returns true on success, false otherwise. This increments the reference | 53 crypto::ScopedEVP_PKEY FetchClientCertPrivateKey(const X509Certificate* cert); |
54 // count of the private key on success. | |
55 bool FetchClientCertPrivateKey(const X509Certificate* cert, | |
56 crypto::ScopedEVP_PKEY* private_key); | |
57 | 54 |
58 // Flush all recorded keys. | 55 // Flush all recorded keys. |
59 void Flush(); | 56 void Flush(); |
60 | 57 |
61 protected: | 58 protected: |
62 OpenSSLClientKeyStore(); | 59 OpenSSLClientKeyStore(); |
63 | 60 |
64 ~OpenSSLClientKeyStore(); | 61 ~OpenSSLClientKeyStore(); |
65 | 62 |
66 // Adds a given public/private key pair. | 63 // Adds a given public/private key pair. |
(...skipping 25 matching lines...) Expand all Loading... |
92 std::vector<KeyPair> pairs_; | 89 std::vector<KeyPair> pairs_; |
93 | 90 |
94 friend struct DefaultSingletonTraits<OpenSSLClientKeyStore>; | 91 friend struct DefaultSingletonTraits<OpenSSLClientKeyStore>; |
95 | 92 |
96 DISALLOW_COPY_AND_ASSIGN(OpenSSLClientKeyStore); | 93 DISALLOW_COPY_AND_ASSIGN(OpenSSLClientKeyStore); |
97 }; | 94 }; |
98 | 95 |
99 } // namespace net | 96 } // namespace net |
100 | 97 |
101 #endif // NET_SSL_OPENSSL_CLIENT_KEY_STORE_H_ | 98 #endif // NET_SSL_OPENSSL_CLIENT_KEY_STORE_H_ |
OLD | NEW |