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_NSS_H_ | 5 #ifndef NET_SSL_CLIENT_CERT_STORE_NSS_H_ |
6 #define NET_SSL_CLIENT_CERT_STORE_NSS_H_ | 6 #define NET_SSL_CLIENT_CERT_STORE_NSS_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 public: | 26 public: |
27 typedef base::Callback<crypto::CryptoModuleBlockingPasswordDelegate*( | 27 typedef base::Callback<crypto::CryptoModuleBlockingPasswordDelegate*( |
28 const HostPortPair& /* server */)> PasswordDelegateFactory; | 28 const HostPortPair& /* server */)> PasswordDelegateFactory; |
29 | 29 |
30 explicit ClientCertStoreNSS( | 30 explicit ClientCertStoreNSS( |
31 const PasswordDelegateFactory& password_delegate_factory); | 31 const PasswordDelegateFactory& password_delegate_factory); |
32 ~ClientCertStoreNSS() override; | 32 ~ClientCertStoreNSS() override; |
33 | 33 |
34 // ClientCertStore: | 34 // ClientCertStore: |
35 void GetClientCerts(const SSLCertRequestInfo& cert_request_info, | 35 void GetClientCerts(const SSLCertRequestInfo& cert_request_info, |
36 const ClientCertListCallback& callback) override; | 36 CertificateList* selected_certs, |
| 37 const base::Closure& callback) override; |
37 | 38 |
38 // Examines the certificates in |certs| to find all certificates that match | 39 // Examines the certificates in |certs| to find all certificates that match |
39 // the client certificate request in |request|, storing the matching | 40 // the client certificate request in |request|, storing the matching |
40 // certificates in |filtered_certs|. Any previous content of |filtered_certs| | 41 // certificates in |filtered_certs|. Any previous content of |filtered_certs| |
41 // will be removed. | 42 // will be removed. |
42 // Must be called from a worker thread. | 43 // Must be called from a worker thread. |
43 static void FilterCertsOnWorkerThread(const CertificateList& certs, | 44 static void FilterCertsOnWorkerThread(const CertificateList& certs, |
44 const SSLCertRequestInfo& request, | 45 const SSLCertRequestInfo& request, |
45 CertificateList* filtered_certs); | 46 CertificateList* filtered_certs); |
46 | 47 |
47 // Retrieves all client certificates that are stored by NSS and adds them to | 48 // Retrieves all client certificates that are stored by NSS and adds them to |
48 // |certs|. |password_delegate| is used to unlock slots if required. | 49 // |certs|. |password_delegate| is used to unlock slots if required. |
49 // Must be called from a worker thread. | 50 // Must be called from a worker thread. |
50 static void GetPlatformCertsOnWorkerThread( | 51 static void GetPlatformCertsOnWorkerThread( |
51 std::unique_ptr<crypto::CryptoModuleBlockingPasswordDelegate> | 52 std::unique_ptr<crypto::CryptoModuleBlockingPasswordDelegate> |
52 password_delegate, | 53 password_delegate, |
53 net::CertificateList* certs); | 54 net::CertificateList* certs); |
54 | 55 |
55 private: | 56 private: |
56 CertificateList GetAndFilterCertsOnWorkerThread( | 57 void GetAndFilterCertsOnWorkerThread( |
57 std::unique_ptr<crypto::CryptoModuleBlockingPasswordDelegate> | 58 std::unique_ptr<crypto::CryptoModuleBlockingPasswordDelegate> |
58 password_delegate, | 59 password_delegate, |
59 const SSLCertRequestInfo* request); | 60 const SSLCertRequestInfo* request, |
| 61 CertificateList* selected_certs); |
60 | 62 |
61 // The factory for creating the delegate for requesting a password to a | 63 // The factory for creating the delegate for requesting a password to a |
62 // PKCS#11 token. May be null. | 64 // PKCS#11 token. May be null. |
63 PasswordDelegateFactory password_delegate_factory_; | 65 PasswordDelegateFactory password_delegate_factory_; |
64 | 66 |
65 DISALLOW_COPY_AND_ASSIGN(ClientCertStoreNSS); | 67 DISALLOW_COPY_AND_ASSIGN(ClientCertStoreNSS); |
66 }; | 68 }; |
67 | 69 |
68 } // namespace net | 70 } // namespace net |
69 | 71 |
70 #endif // NET_SSL_CLIENT_CERT_STORE_NSS_H_ | 72 #endif // NET_SSL_CLIENT_CERT_STORE_NSS_H_ |
OLD | NEW |