次の方法で共有


X509ServiceCertificateAuthentication.CertificateValidationMode プロパティ

定義

証明書検証モードを取得または設定します。

public:
 property System::ServiceModel::Security::X509CertificateValidationMode CertificateValidationMode { System::ServiceModel::Security::X509CertificateValidationMode get(); void set(System::ServiceModel::Security::X509CertificateValidationMode value); };
public System.ServiceModel.Security.X509CertificateValidationMode CertificateValidationMode { get; set; }
member this.CertificateValidationMode : System.ServiceModel.Security.X509CertificateValidationMode with get, set
Public Property CertificateValidationMode As X509CertificateValidationMode

プロパティ値

X509CertificateValidationMode 内の列挙値。

次のコードに、このプロパティを設定する方法を示します。

ClientCredentials creds = new ClientCredentials();
// Configure peer trust.
creds.ServiceCertificate.Authentication.CertificateValidationMode =
          X509CertificateValidationMode.PeerTrust;

// Configure chain trust.
creds.ServiceCertificate.Authentication.CertificateValidationMode =
              X509CertificateValidationMode.ChainTrust;

// Configure custom certificate validation.
creds.ServiceCertificate.Authentication.CertificateValidationMode =
              X509CertificateValidationMode.Custom;
creds.ServiceCertificate.Authentication.CustomCertificateValidator =
    new MyCertificateValidator();
Dim creds As New ClientCredentials()
' Configure peer trust.
creds.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.PeerTrust

' Configure chain trust.
creds.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.ChainTrust

' Configure custom certificate validation.
creds.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.Custom
creds.ServiceCertificate.Authentication.CustomCertificateValidator = New MyCertificateValidator()

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

注釈

この列挙体は、SSL/TLS ネゴシエーションを使用して取得されたサービス証明書の有効性を確認するためのオプションを示します。 この列挙体のメンバーの一覧については、X509CertificateValidationMode を参照してください。

適用対象