| 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 CertificateList* selected_certs, | 36 const ClientCertListCallback& callback) override; |
| 37 const base::Closure& callback) override; | |
| 38 | 37 |
| 39 // Examines the certificates in |certs| to find all certificates that match | 38 // Examines the certificates in |certs| to find all certificates that match |
| 40 // the client certificate request in |request|, storing the matching | 39 // the client certificate request in |request|, storing the matching |
| 41 // certificates in |filtered_certs|. Any previous content of |filtered_certs| | 40 // certificates in |filtered_certs|. Any previous content of |filtered_certs| |
| 42 // will be removed. | 41 // will be removed. |
| 43 // Must be called from a worker thread. | 42 // Must be called from a worker thread. |
| 44 static void FilterCertsOnWorkerThread(const CertificateList& certs, | 43 static void FilterCertsOnWorkerThread(const CertificateList& certs, |
| 45 const SSLCertRequestInfo& request, | 44 const SSLCertRequestInfo& request, |
| 46 CertificateList* filtered_certs); | 45 CertificateList* filtered_certs); |
| 47 | 46 |
| 48 // Retrieves all client certificates that are stored by NSS and adds them to | 47 // Retrieves all client certificates that are stored by NSS and adds them to |
| 49 // |certs|. |password_delegate| is used to unlock slots if required. | 48 // |certs|. |password_delegate| is used to unlock slots if required. |
| 50 // Must be called from a worker thread. | 49 // Must be called from a worker thread. |
| 51 static void GetPlatformCertsOnWorkerThread( | 50 static void GetPlatformCertsOnWorkerThread( |
| 52 std::unique_ptr<crypto::CryptoModuleBlockingPasswordDelegate> | 51 std::unique_ptr<crypto::CryptoModuleBlockingPasswordDelegate> |
| 53 password_delegate, | 52 password_delegate, |
| 54 net::CertificateList* certs); | 53 net::CertificateList* certs); |
| 55 | 54 |
| 56 private: | 55 private: |
| 57 void GetAndFilterCertsOnWorkerThread( | 56 CertificateList GetAndFilterCertsOnWorkerThread( |
| 58 std::unique_ptr<crypto::CryptoModuleBlockingPasswordDelegate> | 57 std::unique_ptr<crypto::CryptoModuleBlockingPasswordDelegate> |
| 59 password_delegate, | 58 password_delegate, |
| 60 const SSLCertRequestInfo* request, | 59 const SSLCertRequestInfo* request); |
| 61 CertificateList* selected_certs); | |
| 62 | 60 |
| 63 // The factory for creating the delegate for requesting a password to a | 61 // The factory for creating the delegate for requesting a password to a |
| 64 // PKCS#11 token. May be null. | 62 // PKCS#11 token. May be null. |
| 65 PasswordDelegateFactory password_delegate_factory_; | 63 PasswordDelegateFactory password_delegate_factory_; |
| 66 | 64 |
| 67 DISALLOW_COPY_AND_ASSIGN(ClientCertStoreNSS); | 65 DISALLOW_COPY_AND_ASSIGN(ClientCertStoreNSS); |
| 68 }; | 66 }; |
| 69 | 67 |
| 70 } // namespace net | 68 } // namespace net |
| 71 | 69 |
| 72 #endif // NET_SSL_CLIENT_CERT_STORE_NSS_H_ | 70 #endif // NET_SSL_CLIENT_CERT_STORE_NSS_H_ |
| OLD | NEW |