X509CertificateInitiatorServiceCredential.SetCertificate Method (StoreLocation, StoreName, X509FindType, Object)
Specifies the certificate to use for encrypting messages for the client. This setting is used only by bindings that are configured with the MutualCertificateDuplex message security authentication mode.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
public void SetCertificate( StoreLocation storeLocation, StoreName storeName, X509FindType findType, Object findValue )
- Type: System.Security.Cryptography.X509Certificates.StoreLocation
The location of the certificate store that the service uses to obtain the certificate.
- Type: System.Security.Cryptography.X509Certificates.StoreName
The name of the X.509 certificate store to open.
- Type: System.Security.Cryptography.X509Certificates.X509FindType
The type of X.509 search to be executed.
- Type: System.Object
The value to search for in the X.509 certificate store.
Values for storeLocation are included in the StoreLocation enumeration:
LocalMachine: the certificate store assigned to the local machine (default).
CurrentUser: the certificate store used by the current user.
If the application is running under a system account, then the certificate is typically in LocalMachine. If the application is running under a user account, then the certificate is typically in CurrentUser.
Values for storeName are included in the StoreName enumeration.
Values for findType are included in the X509FindType enumeration.
The most commonly used enumeration is FindBySubjectName, which does a case-insensitive search on the subject name of certificates in the specified store. This can be an imprecise search. If no certificates or multiple certificates that match the criteria are found, an InvalidOperationException is thrown.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.