X509ClientCertificateAuthentication.CertificateValidationMode Özellik
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Sertifika doğrulama modunu alır veya ayarlar.
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
Özellik Değeri
Değerlerden X509CertificateValidationMode biri.
Örnekler
Aşağıdaki örnek, ekrana yazdırmak için öğesini CertificateValidationMode kullanır.
// 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;
switch (myAuthProperties.CertificateValidationMode)
{
case X509CertificateValidationMode.ChainTrust:
Console.WriteLine("ChainTrust");
break;
case X509CertificateValidationMode.Custom:
Console.WriteLine("Custom");
break;
case X509CertificateValidationMode.None:
Console.WriteLine("ChainTrust");
break;
case X509CertificateValidationMode.PeerOrChainTrust:
Console.WriteLine("PeerOrChainTrust");
break;
case X509CertificateValidationMode.PeerTrust:
Console.WriteLine("PeerTrust");
break;
default:
Console.WriteLine("Default");
break;
}
' 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()
Select Case myAuthProperties.CertificateValidationMode
Case X509CertificateValidationMode.ChainTrust
Console.WriteLine("ChainTrust")
Case X509CertificateValidationMode.Custom
Console.WriteLine("Custom")
Case X509CertificateValidationMode.None
Console.WriteLine("ChainTrust")
Case X509CertificateValidationMode.PeerOrChainTrust
Console.WriteLine("PeerOrChainTrust")
Case X509CertificateValidationMode.PeerTrust
Console.WriteLine("PeerTrust")
Case Else
Console.WriteLine("Default")
End Select
özelliği bir yapılandırma dosyasında da ayarlanabilir.
<serviceCredentials>
<clientCertificate>
<authentication certificateValidationMode='ChainTrust' />
</clientCertificate>
</serviceCredentials>
Açıklamalar
İzin verilen değerleri X509CertificateValidationMode şunlardır: