DefaultCertificateDelegate Delegate

Represents a method that is called when the .NET Framework needs to determine which certificate to use for authentication.

public delegate X509Certificate DefaultCertificateDelegate(object sender, String targetHost, X509CertificateCollection localCertificates, X509Certificate remoteCertificate, String[] acceptableIssuers);

Syntax

public delegate X509Certificate DefaultCertificateDelegate(object sender, String targetHost, X509CertificateCollection localCertificates, X509Certificate remoteCertificate, String[] acceptableIssuers);
        

Parameters

Return Value

An X509Certificate that represents the certificate to be used for authentication. Can be null to indicate that no certificate should be used.

Remarks

The DefaultCertificateDelegate delegate is used by the AuthenticationContext class to specify a callback method that handles the selection of an X509Certificate for client authentication.

When a client application connects to a server that requires client authentication, the .NET Framework invokes the method pointed to by this delegate. The delegate method receives information about the server and the available certificates and is responsible for returning an appropriate client certificate to be used for authentication.

Important: If your application uses this delegate, ensure that the callback method is thread-safe and handles potential exceptions gracefully. Properly managing the lifecycle and security of certificates is crucial.

Requirements

Requirement Details
Namespace System.Net.Security
Assembly System.Net.dll
Platform Windows, Linux, macOS

See Also