ClientCredentials.ClientCertificate Property

Definition

Gets an object that you can use to provide the X.509 certificate that the client uses to authenticate to the service.

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

Property Value

An X509CertificateInitiatorClientCredential that represents the client certificate.

Examples

The following code shows how you can use this property to configure the X.509 certificate.

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");

Remarks

You can also set this value using the <certificate> in a client application configuration file.

Applies to

Product Versions
.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)