OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_IMPL_H_ | 5 #ifndef NET_SSL_CLIENT_CERT_STORE_IMPL_H_ |
6 #define NET_SSL_CLIENT_CERT_STORE_IMPL_H_ | 6 #define NET_SSL_CLIENT_CERT_STORE_IMPL_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | |
9 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
10 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
11 #include "net/ssl/client_cert_store.h" | 12 #include "net/ssl/client_cert_store.h" |
12 #include "net/ssl/ssl_cert_request_info.h" | 13 #include "net/ssl/ssl_cert_request_info.h" |
13 | 14 |
15 namespace crypto { | |
16 class CryptoModuleBlockingPasswordDelegate; | |
17 } | |
18 | |
14 namespace net { | 19 namespace net { |
15 | 20 |
16 class NET_EXPORT ClientCertStoreImpl : public ClientCertStore { | 21 class NET_EXPORT ClientCertStoreImpl : public ClientCertStore { |
17 public: | 22 public: |
18 ClientCertStoreImpl() {} | 23 ClientCertStoreImpl(); |
19 virtual ~ClientCertStoreImpl() {} | 24 virtual ~ClientCertStoreImpl(); |
20 | 25 |
21 // ClientCertStore: | 26 // ClientCertStore: |
22 virtual void GetClientCerts(const SSLCertRequestInfo& cert_request_info, | 27 virtual void GetClientCerts(const SSLCertRequestInfo& cert_request_info, |
23 CertificateList* selected_certs, | 28 CertificateList* selected_certs, |
24 const base::Closure& callback) OVERRIDE; | 29 const base::Closure& callback) OVERRIDE; |
25 | 30 |
31 #if defined(USE_NSS) | |
32 typedef base::Callback<crypto::CryptoModuleBlockingPasswordDelegate*( | |
33 const std::string&)> PasswordDelegateFactory; | |
Ryan Sleevi
2013/11/26 19:59:03
Can you include a documentation note about what th
mattm
2013/11/26 21:49:14
Done.
| |
34 void set_password_delegate_factory( | |
Ryan Sleevi
2013/11/26 19:59:03
style: Shouldn't this be SetPasswordDelegateFactor
mattm
2013/11/26 21:49:14
Style guide says that simple setters & getters use
| |
35 const PasswordDelegateFactory& password_delegate_factory); | |
36 #endif | |
37 | |
26 private: | 38 private: |
27 friend class ClientCertStoreImplTest; | 39 friend class ClientCertStoreImplTest; |
28 | 40 |
29 // A hook for testing. Filters |input_certs| using the logic being used to | 41 // A hook for testing. Filters |input_certs| using the logic being used to |
30 // filter the system store when GetClientCerts() is called. Depending on the | 42 // filter the system store when GetClientCerts() is called. Depending on the |
31 // implementation, this might be: | 43 // implementation, this might be: |
32 // - Implemented by creating a temporary in-memory store and filtering it | 44 // - Implemented by creating a temporary in-memory store and filtering it |
33 // using the common logic (preferable, currently on Windows). | 45 // using the common logic (preferable, currently on Windows). |
34 // - Implemented by creating a list of certificates that otherwise would be | 46 // - Implemented by creating a list of certificates that otherwise would be |
35 // extracted from the system store and filtering it using the common logic | 47 // extracted from the system store and filtering it using the common logic |
36 // (less adequate, currently on NSS and Mac). | 48 // (less adequate, currently on NSS and Mac). |
37 bool SelectClientCertsForTesting(const CertificateList& input_certs, | 49 bool SelectClientCertsForTesting(const CertificateList& input_certs, |
38 const SSLCertRequestInfo& cert_request_info, | 50 const SSLCertRequestInfo& cert_request_info, |
39 CertificateList* selected_certs); | 51 CertificateList* selected_certs); |
40 | 52 |
41 #if defined(OS_MACOSX) && !defined(OS_IOS) | 53 #if defined(OS_MACOSX) && !defined(OS_IOS) |
42 // Testing hook specific to Mac, where the internal logic recognizes preferred | 54 // Testing hook specific to Mac, where the internal logic recognizes preferred |
43 // certificates for particular domains. If the preferred certificate is | 55 // certificates for particular domains. If the preferred certificate is |
44 // present in the output list (i.e. it doesn't get filtered out), it should | 56 // present in the output list (i.e. it doesn't get filtered out), it should |
45 // always come first. | 57 // always come first. |
46 bool SelectClientCertsGivenPreferredForTesting( | 58 bool SelectClientCertsGivenPreferredForTesting( |
47 const scoped_refptr<X509Certificate>& preferred_cert, | 59 const scoped_refptr<X509Certificate>& preferred_cert, |
48 const CertificateList& regular_certs, | 60 const CertificateList& regular_certs, |
49 const SSLCertRequestInfo& request, | 61 const SSLCertRequestInfo& request, |
50 CertificateList* selected_certs); | 62 CertificateList* selected_certs); |
51 #endif | 63 #endif |
52 | 64 |
65 #if defined(USE_NSS) | |
66 // The factory for creating the delegate for requesting a password to a | |
67 // PKCS#11 token. May be null. | |
68 PasswordDelegateFactory password_delegate_factory_; | |
69 #endif // defined(USE_NSS) | |
70 | |
53 DISALLOW_COPY_AND_ASSIGN(ClientCertStoreImpl); | 71 DISALLOW_COPY_AND_ASSIGN(ClientCertStoreImpl); |
54 }; | 72 }; |
55 | 73 |
56 } // namespace net | 74 } // namespace net |
57 | 75 |
58 #endif // NET_SSL_CLIENT_CERT_STORE_IMPL_H_ | 76 #endif // NET_SSL_CLIENT_CERT_STORE_IMPL_H_ |
OLD | NEW |