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