次の方法で共有


X509ClientCertificateAuthentication.TrustedStoreLocation プロパティ

定義

クライアント証明書チェーンを検証するためのコンテキストとなる信頼されたストアの場所を取得または設定します。

public:
 property System::Security::Cryptography::X509Certificates::StoreLocation TrustedStoreLocation { System::Security::Cryptography::X509Certificates::StoreLocation get(); void set(System::Security::Cryptography::X509Certificates::StoreLocation value); };
public System.Security.Cryptography.X509Certificates.StoreLocation TrustedStoreLocation { get; set; }
member this.TrustedStoreLocation : System.Security.Cryptography.X509Certificates.StoreLocation with get, set
Public Property TrustedStoreLocation As StoreLocation

プロパティ値

クライアント証明書チェーンを検証するためのコンテキストとなる信頼されたストアの場所。

例外

資格情報が読み取り専用のとき set

// Create a service host.
Uri httpUri = new Uri("http://localhost/Calculator");
ServiceHost sh = new ServiceHost(typeof(Calculator), httpUri);

// Create a binding that uses a certificate.
WSHttpBinding b = new WSHttpBinding(SecurityMode.Message);
b.Security.Message.ClientCredentialType =
    MessageCredentialType.Certificate;

// Get a reference to the authentication object.
X509ClientCertificateAuthentication myAuthProperties =
    sh.Credentials.ClientCertificate.Authentication;
// Configure peer trust.
myAuthProperties.CertificateValidationMode =
    X509CertificateValidationMode.PeerTrust;
myAuthProperties.TrustedStoreLocation =
    StoreLocation.LocalMachine;
' Create a service host.
Dim httpUri As New Uri("http://localhost/Calculator")
Dim sh As New ServiceHost(GetType(Calculator), httpUri)

' Create a binding that uses a certificate.
Dim b As New WSHttpBinding(SecurityMode.Message)
b.Security.Message.ClientCredentialType = _
MessageCredentialType.Certificate

' Get a reference to the authentication object.
Dim myAuthProperties As X509ClientCertificateAuthentication = _
sh.Credentials.ClientCertificate.Authentication
' Configure peer trust.
myAuthProperties.CertificateValidationMode = _
X509CertificateValidationMode.PeerTrust
myAuthProperties.TrustedStoreLocation = StoreLocation.LocalMachine

プロパティは構成ファイル内でも設定できます。

<serviceCredentials>  
  <clientCertificate>  
     <authentication certificateValidationMode='ChainTrust'   trustedStoreLocation = 'LocalMachine'/>  
  </clientCertificate>  
</serviceCredentials>  

注釈

このプロパティは、X.509 証明書チェーンの検証にコンピューターのコンテキストを使用するのか、それともユーザーのコンテキストを使用するのかを指定します。

適用対象