| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_BASE_CLIENT_CERT_STORE_IMPL_H_ | |
| 6 #define NET_BASE_CLIENT_CERT_STORE_IMPL_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/gtest_prod_util.h" | |
| 10 #include "net/base/client_cert_store.h" | |
| 11 #include "net/base/net_export.h" | |
| 12 #include "net/base/ssl_cert_request_info.h" | |
| 13 | |
| 14 namespace net { | |
| 15 | |
| 16 class NET_EXPORT ClientCertStoreImpl : public ClientCertStore { | |
| 17 public: | |
| 18 ClientCertStoreImpl() {} | |
| 19 | |
| 20 virtual ~ClientCertStoreImpl() {} | |
| 21 | |
| 22 // ClientCertStore: | |
| 23 virtual bool GetClientCerts(const SSLCertRequestInfo& cert_request_info, | |
| 24 CertificateList* selected_certs) OVERRIDE; | |
| 25 | |
| 26 private: | |
| 27 FRIEND_TEST_ALL_PREFIXES(ClientCertStoreImplTest, EmptyQuery); | |
| 28 FRIEND_TEST_ALL_PREFIXES(ClientCertStoreImplTest, AllIssuersAllowed); | |
| 29 FRIEND_TEST_ALL_PREFIXES(ClientCertStoreImplTest, CertAuthorityFiltering); | |
| 30 #if defined(OS_MACOSX) && !defined(OS_IOS) | |
| 31 FRIEND_TEST_ALL_PREFIXES(ClientCertStoreImplTest, FilterOutThePreferredCert); | |
| 32 FRIEND_TEST_ALL_PREFIXES(ClientCertStoreImplTest, PreferredCertGoesFirst); | |
| 33 #endif | |
| 34 | |
| 35 // A hook for testing. Filters |input_certs| using the logic being used to | |
| 36 // filter the system store when GetClientCerts() is called. Depending on the | |
| 37 // implementation, this might be: | |
| 38 // - Implemented by creating a temporary in-memory store and filtering it | |
| 39 // using the common logic (preferable, currently on Windows). | |
| 40 // - Implemented by creating a list of certificates that otherwise would be | |
| 41 // extracted from the system store and filtering it using the common logic | |
| 42 // (less adequate, currently on NSS and Mac). | |
| 43 bool SelectClientCerts(const CertificateList& input_certs, | |
| 44 const SSLCertRequestInfo& cert_request_info, | |
| 45 CertificateList* selected_certs); | |
| 46 | |
| 47 #if defined(OS_MACOSX) && !defined(OS_IOS) | |
| 48 // Testing hook specific to Mac, where the internal logic recognizes preferred | |
| 49 // certificates for particular domains. If the preferred certificate is | |
| 50 // present in the output list (i.e. it doesn't get filtered out), it should | |
| 51 // always come first. | |
| 52 bool SelectClientCertsGivenPreferred( | |
| 53 const scoped_refptr<X509Certificate>& preferred_cert, | |
| 54 const CertificateList& regular_certs, | |
| 55 const SSLCertRequestInfo& request, | |
| 56 CertificateList* selected_certs); | |
| 57 #endif | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(ClientCertStoreImpl); | |
| 60 }; | |
| 61 | |
| 62 } // namespace net | |
| 63 | |
| 64 #endif // NET_BASE_CLIENT_CERT_STORE_IMPL_H_ | |
| OLD | NEW |