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