1 // Copyright 2012 The Chromium Authors 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_H_ 6 #define NET_SSL_CLIENT_CERT_STORE_H_ 7 8 #include "base/functional/callback_forward.h" 9 #include "net/base/net_export.h" 10 #include "net/cert/x509_certificate.h" 11 #include "net/ssl/client_cert_identity.h" 12 13 namespace net { 14 15 class SSLCertRequestInfo; 16 17 // A handle to a client certificate store to query matching certificates when a 18 // server requests client auth. Note that there may be multiple ClientCertStore 19 // objects corresponding to the same platform certificate store; each request 20 // gets its own uniquely owned handle. 21 class NET_EXPORT ClientCertStore { 22 public: 23 ClientCertStore(const ClientCertStore&) = delete; 24 ClientCertStore& operator=(const ClientCertStore&) = delete; 25 26 virtual ~ClientCertStore() = default; 27 28 using ClientCertListCallback = 29 base::OnceCallback<void(ClientCertIdentityList)>; 30 31 // Get client certs matching the |cert_request_info| and pass them to the 32 // |callback|. The |callback| may be called sychronously. The caller must 33 // ensure the ClientCertStore and |cert_request_info| remain alive until the 34 // callback has been run. 35 virtual void GetClientCerts(const SSLCertRequestInfo& cert_request_info, 36 ClientCertListCallback callback) = 0; 37 38 protected: 39 ClientCertStore() = default; 40 }; 41 42 } // namespace net 43 44 #endif // NET_SSL_CLIENT_CERT_STORE_H_ 45