X509CertificateInitiatorServiceCredential.SetCertificate Method (String, StoreLocation, StoreName)
Enables you to specify the certificate to use for encrypting messages for the client by specifying the subject distinguished name. 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( string subjectName, StoreLocation storeLocation, StoreName storeName )
- Type: System.String
Subject distinguished name.
- 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.
For more information about the subjectName parameter, see SubjectName.
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 client application is running under a system account, then the certificate is typically in LocalMachine. If the client application is running under a user account, then the certificate is typically in CurrentUser.
Values for storeName are included in the StoreName enumeration.
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.