Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_SSL_CLIENT_CERT_STORE_CHROMEOS_H_ | |
| 6 #define NET_SSL_CLIENT_CERT_STORE_CHROMEOS_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "crypto/scoped_nss_types.h" | |
| 11 #include "net/cert/nss_profile_filter_chromeos.h" | |
| 12 #include "net/ssl/client_cert_store_nss.h" | |
| 13 | |
| 14 namespace net { | |
| 15 | |
| 16 class NET_EXPORT ClientCertStoreChromeOS : public ClientCertStoreNSS { | |
| 17 public: | |
| 18 ClientCertStoreChromeOS( | |
| 19 const std::string& username_hash, | |
| 20 const PasswordDelegateFactory& password_delegate_factory); | |
| 21 virtual ~ClientCertStoreChromeOS(); | |
| 22 | |
| 23 // ClientCertStoreNSS: | |
| 24 virtual void GetClientCerts(const SSLCertRequestInfo& cert_request_info, | |
| 25 CertificateList* selected_certs, | |
| 26 const base::Closure& callback) OVERRIDE; | |
| 27 | |
| 28 protected: | |
| 29 // ClientCertStoreNSS: | |
| 30 virtual void GetClientCertsImpl(CERTCertList* cert_list, | |
| 31 const SSLCertRequestInfo& request, | |
| 32 bool query_nssdb, | |
| 33 CertificateList* selected_certs) OVERRIDE; | |
| 34 | |
| 35 private: | |
| 36 friend class ClientCertStoreChromeOSTestDelegate; | |
| 37 | |
| 38 void DidGetPrivateSlot(const SSLCertRequestInfo* request, | |
| 39 CertificateList* selected_certs, | |
| 40 const base::Closure& callback, | |
| 41 crypto::ScopedPK11Slot private_slot); | |
| 42 | |
| 43 // Allows tests to initialize the cert store with the given slots. | |
| 44 // Must be called before SelectClientCertsForTesting. | |
| 45 void InitForTesting(crypto::ScopedPK11Slot public_slot, | |
| 46 crypto::ScopedPK11Slot private_slot); | |
| 47 | |
| 48 // A hook for testing. Filters |input_certs| using the logic being used to | |
| 49 // filter the system store when GetClientCerts() is called. | |
| 50 // Implemented by creating a list of certificates that otherwise would be | |
| 51 // extracted from the system store and filtering it using the common logic | |
| 52 // (less adequate than the approach used on Windows). | |
| 53 bool SelectClientCertsForTesting(const CertificateList& input_certs, | |
| 54 const SSLCertRequestInfo& cert_request_info, | |
| 55 CertificateList* selected_certs); | |
| 56 | |
| 57 | |
| 58 std::string username_hash_; | |
| 59 | |
| 60 NSSProfileFilterChromeOS profile_filter_; | |
|
Ryan Sleevi
2013/12/11 06:52:50
nit: delete newline? or add comments?
mattm
2013/12/12 00:45:22
Done.
| |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(ClientCertStoreChromeOS); | |
| 63 }; | |
| 64 | |
| 65 } // namespace net | |
| 66 | |
| 67 #endif // NET_SSL_CLIENT_CERT_STORE_CHROMEOS_H_ | |
| OLD | NEW |