OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_CLIENT_CERT_STORE_WIN_H_ | 5 #ifndef NET_SSL_CLIENT_CERT_STORE_WIN_H_ |
6 #define NET_SSL_CLIENT_CERT_STORE_WIN_H_ | 6 #define NET_SSL_CLIENT_CERT_STORE_WIN_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "crypto/scoped_capi_types.h" | 10 #include "crypto/scoped_capi_types.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 // Takes ownership of |cert_store| and closes it at destruction time. | 22 // Takes ownership of |cert_store| and closes it at destruction time. |
23 explicit ClientCertStoreWin(HCERTSTORE cert_store); | 23 explicit ClientCertStoreWin(HCERTSTORE cert_store); |
24 | 24 |
25 ~ClientCertStoreWin() override; | 25 ~ClientCertStoreWin() override; |
26 | 26 |
27 // If a cert store has been provided at construction time GetClientCerts | 27 // If a cert store has been provided at construction time GetClientCerts |
28 // will use that. Otherwise it will use the current user's "MY" cert store | 28 // will use that. Otherwise it will use the current user's "MY" cert store |
29 // instead. | 29 // instead. |
30 void GetClientCerts(const SSLCertRequestInfo& cert_request_info, | 30 void GetClientCerts(const SSLCertRequestInfo& cert_request_info, |
31 CertificateList* selected_certs, | 31 const ClientCertListCallback& callback) override; |
32 const base::Closure& callback) override; | |
33 | 32 |
34 private: | 33 private: |
35 using ScopedHCERTSTORE = crypto::ScopedCAPIHandle< | 34 using ScopedHCERTSTORE = crypto::ScopedCAPIHandle< |
36 HCERTSTORE, | 35 HCERTSTORE, |
37 crypto::CAPIDestroyerWithFlags<HCERTSTORE, | 36 crypto::CAPIDestroyerWithFlags<HCERTSTORE, |
38 CertCloseStore, | 37 CertCloseStore, |
39 CERT_CLOSE_STORE_CHECK_FLAG>>; | 38 CERT_CLOSE_STORE_CHECK_FLAG>>; |
40 | 39 |
41 friend class ClientCertStoreWinTestDelegate; | 40 friend class ClientCertStoreWinTestDelegate; |
42 | 41 |
43 // A hook for testing. Filters |input_certs| using the logic being used to | 42 // A hook for testing. Filters |input_certs| using the logic being used to |
44 // filter the system store when GetClientCerts() is called. | 43 // filter the system store when GetClientCerts() is called. |
45 // Implemented by creating a temporary in-memory store and filtering it | 44 // Implemented by creating a temporary in-memory store and filtering it |
46 // using the common logic. | 45 // using the common logic. |
47 bool SelectClientCertsForTesting(const CertificateList& input_certs, | 46 bool SelectClientCertsForTesting(const CertificateList& input_certs, |
48 const SSLCertRequestInfo& cert_request_info, | 47 const SSLCertRequestInfo& cert_request_info, |
49 CertificateList* selected_certs); | 48 CertificateList* selected_certs); |
50 | 49 |
51 ScopedHCERTSTORE cert_store_; | 50 ScopedHCERTSTORE cert_store_; |
52 | 51 |
53 DISALLOW_COPY_AND_ASSIGN(ClientCertStoreWin); | 52 DISALLOW_COPY_AND_ASSIGN(ClientCertStoreWin); |
54 }; | 53 }; |
55 | 54 |
56 } // namespace net | 55 } // namespace net |
57 | 56 |
58 #endif // NET_SSL_CLIENT_CERT_STORE_WIN_H_ | 57 #endif // NET_SSL_CLIENT_CERT_STORE_WIN_H_ |
OLD | NEW |