LocalCertificateSelectionCallback デリゲート
アセンブリ: System (system.dll 内)

Public Delegate Function LocalCertificateSelectionCallback ( _ sender As Object, _ targetHost As String, _ localCertificates As X509CertificateCollection, _ remoteCertificate As X509Certificate, _ acceptableIssuers As String() _ ) As X509Certificate
public delegate X509Certificate LocalCertificateSelectionCallback ( Object sender, string targetHost, X509CertificateCollection localCertificates, X509Certificate remoteCertificate, string[] acceptableIssuers )
public delegate X509Certificate^ LocalCertificateSelectionCallback ( Object^ sender, String^ targetHost, X509CertificateCollection^ localCertificates, X509Certificate^ remoteCertificate, array<String^>^ acceptableIssuers )
/** @delegate */ public delegate X509Certificate LocalCertificateSelectionCallback ( Object sender, String targetHost, X509CertificateCollection localCertificates, X509Certificate remoteCertificate, String[] acceptableIssuers )
戻り値
SSL 接続の確立に使用する X509Certificate。

このデリゲートは、SslStream クラスのインスタンスを生成するために使用されます。SslStream クラスは、クライアントとサーバーの間で交換される情報をセキュリティ保護できるようにするために使用されます。クライアントとサーバーは、このデリゲートを使用して、認証に使用される証明書を選択します。

public static X509Certificate SelectLocalCertificate( object sender, string targetHost, X509CertificateCollection localCertificates, X509Certificate remoteCertificate, string[] acceptableIssuers) { Console.WriteLine("Client is selecting a local certificate."); if (acceptableIssuers != null && acceptableIssuers.Length > 0 && localCertificates != null && localCertificates.Count > 0) { // Use the first certificate that is from an acceptable issuer. foreach (X509Certificate certificate in localCertificates) { string issuer = certificate.Issuer; if (Array.IndexOf(acceptableIssuers, issuer) != -1) return certificate; } } if (localCertificates != null && localCertificates.Count > 0) return localCertificates[0]; return null; }
このデリゲートのインスタンスを作成するコード例を次に示します。
// Server name must match the host name and the name on the host's certificate. serverName = args[0]; // Create a TCP/IP client socket. TcpClient client = new TcpClient(serverName,80); Console.WriteLine("Client connected."); // Create an SSL stream that will close the client's stream. SslStream sslStream = new SslStream( client.GetStream(), false, new RemoteCertificateValidationCallback (ValidateServerCertificate), new LocalCertificateSelectionCallback(SelectLocalCertificate) );

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- LocalCertificateSelectionCallback デリゲートのページへのリンク