Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: net/ssl/client_cert_store_nss.h

Issue 1274143002: ClientCertStoreChromeOS: support additional non-platform certs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Steven's comments. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/profiles/profile_io_data.cc ('k') | net/ssl/client_cert_store_nss.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/basictypes.h"
9 #include "base/callback.h" 8 #include "base/callback.h"
10 #include "base/gtest_prod_util.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "net/base/net_export.h" 11 #include "net/base/net_export.h"
12 #include "net/ssl/client_cert_store.h" 12 #include "net/ssl/client_cert_store.h"
13 #include "net/ssl/ssl_cert_request_info.h"
14 13
15 typedef struct CERTCertListStr CERTCertList; 14 typedef struct CERTCertListStr CERTCertList;
16 15
17 namespace crypto { 16 namespace crypto {
18 class CryptoModuleBlockingPasswordDelegate; 17 class CryptoModuleBlockingPasswordDelegate;
19 } 18 }
20 19
21 namespace net { 20 namespace net {
21 class HostPortPair;
22 class SSLCertRequestInfo;
22 23
23 class NET_EXPORT ClientCertStoreNSS : public ClientCertStore { 24 class NET_EXPORT ClientCertStoreNSS : public ClientCertStore {
24 public: 25 public:
25 typedef base::Callback<crypto::CryptoModuleBlockingPasswordDelegate*( 26 typedef base::Callback<crypto::CryptoModuleBlockingPasswordDelegate*(
26 const HostPortPair& /* server */)> PasswordDelegateFactory; 27 const HostPortPair& /* server */)> PasswordDelegateFactory;
27 28
28 explicit ClientCertStoreNSS( 29 explicit ClientCertStoreNSS(
29 const PasswordDelegateFactory& password_delegate_factory); 30 const PasswordDelegateFactory& password_delegate_factory);
30 ~ClientCertStoreNSS() override; 31 ~ClientCertStoreNSS() override;
31 32
32 // ClientCertStore: 33 // ClientCertStore:
33 void GetClientCerts(const SSLCertRequestInfo& cert_request_info, 34 void GetClientCerts(const SSLCertRequestInfo& cert_request_info,
34 CertificateList* selected_certs, 35 CertificateList* selected_certs,
35 const base::Closure& callback) override; 36 const base::Closure& callback) override;
36 37
37 protected: 38 // Examines the certificates in |certs| to find all certificates that match
38 // Examines the certificates in |cert_list| to find all certificates that 39 // the client certificate request in |request|, storing the matching
39 // match the client certificate request in |request|, storing the matching 40 // certificates in |filtered_certs|. Any previous content of |filtered_certs|
40 // certificates in |selected_certs|. 41 // will be removed.
41 // If |query_nssdb| is true, NSS will be queried to construct full certificate 42 // If |query_nssdb| is true, NSS will be queried to construct full certificate
42 // chains. If it is false, only the certificate will be considered. 43 // chains. If it is false, only the certificate will be considered.
43 virtual void GetClientCertsImpl(CERTCertList* cert_list, 44 // Must be called from a worker thread.
44 const SSLCertRequestInfo& request, 45 static void FilterCertsOnWorkerThread(const CertificateList& certs,
45 bool query_nssdb, 46 const SSLCertRequestInfo& request,
46 CertificateList* selected_certs); 47 bool query_nssdb,
48 CertificateList* filtered_certs);
49
50 // Retrieves all client certificates that are stored by NSS and adds them to
51 // |certs|. |password_delegate| is used to unlock slots if required.
52 // Must be called from a worker thread.
53 static void GetPlatformCertsOnWorkerThread(
54 scoped_ptr<crypto::CryptoModuleBlockingPasswordDelegate>
55 password_delegate,
56 net::CertificateList* certs);
47 57
48 private: 58 private:
49 friend class ClientCertStoreNSSTestDelegate; 59 void GetAndFilterCertsOnWorkerThread(
50
51 void GetClientCertsOnWorkerThread(
52 scoped_ptr<crypto::CryptoModuleBlockingPasswordDelegate> 60 scoped_ptr<crypto::CryptoModuleBlockingPasswordDelegate>
53 password_delegate, 61 password_delegate,
54 const SSLCertRequestInfo* request, 62 const SSLCertRequestInfo* request,
55 CertificateList* selected_certs); 63 CertificateList* selected_certs);
56 64
57 // A hook for testing. Filters |input_certs| using the logic being used to
58 // filter the system store when GetClientCerts() is called.
59 // Implemented by creating a list of certificates that otherwise would be
60 // extracted from the system store and filtering it using the common logic
61 // (less adequate than the approach used on Windows).
62 bool SelectClientCertsForTesting(const CertificateList& input_certs,
63 const SSLCertRequestInfo& cert_request_info,
64 CertificateList* selected_certs);
65
66 // The factory for creating the delegate for requesting a password to a 65 // The factory for creating the delegate for requesting a password to a
67 // PKCS #11 token. May be null. 66 // PKCS#11 token. May be null.
68 PasswordDelegateFactory password_delegate_factory_; 67 PasswordDelegateFactory password_delegate_factory_;
69 68
70 DISALLOW_COPY_AND_ASSIGN(ClientCertStoreNSS); 69 DISALLOW_COPY_AND_ASSIGN(ClientCertStoreNSS);
71 }; 70 };
72 71
73 } // namespace net 72 } // namespace net
74 73
75 #endif // NET_SSL_CLIENT_CERT_STORE_NSS_H_ 74 #endif // NET_SSL_CLIENT_CERT_STORE_NSS_H_
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_io_data.cc ('k') | net/ssl/client_cert_store_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698