英語で読む

次の方法で共有


ClientCredentials.ClientCertificate プロパティ

定義

クライアントがサービスに対して自身を認証するために使用する X.509 証明書を提供するオブジェクトを取得します。

C#
public System.ServiceModel.Security.X509CertificateInitiatorClientCredential ClientCertificate { get; }

プロパティ値

クライアント証明書を表す X509CertificateInitiatorClientCredential

このプロパティを使用して X.509 証明書を構成する方法を次のコードに示します。

C#
// Create the client with the binding and EndpointAddress.
CalculatorClient calcClient = new CalculatorClient(b, ea);

// Set the client credential value to a valid certificate.
calcClient.ClientCredentials.ClientCertificate.SetCertificate(
    StoreLocation.CurrentUser,
    StoreName.TrustedPeople,
    X509FindType.FindBySubjectName,
    "client.com");

注釈

この値は、クライアント アプリケーション構成ファイルの <証明書> を使用して設定することもできます。

適用対象

製品 バージョン
.NET Core 1.0, Core 1.1, 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)