语言

X509ClientCertificateAuthentication.RevocationMode 属性

定义

获取或设置 ChainTrust 和 PeerOrChainTrust X.509 证书验证的证书吊销模式。

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

属性值

中的X509RevocationModeNoCheck值之一,Online或Offline。 默认值为 Online。

例外

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 ChainTrust with no revocation check.
myAuthProperties.CertificateValidationMode =
    X509CertificateValidationMode.ChainTrust;
myAuthProperties.RevocationMode = X509RevocationMode.NoCheck;
' 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 ChainTrust with no revocation check.
myAuthProperties.CertificateValidationMode = _
X509CertificateValidationMode.ChainTrust
myAuthProperties.RevocationMode = X509RevocationMode.NoCheck

还可以在配置文件中设置该属性。

<serviceCredentials>
  <clientCertificate>
     <authentication certificateValidationMode='ChainTrust'   revocationMode = 'NoCheck'/>
  </clientCertificate>
</serviceCredentials>

注解

使用证书时,系统会通过检查客户端证书不在已吊销的证书列表中来验证客户端证书是否未吊销。 可以通过联机检查或通过检查缓存的吊销列表来执行此检查。 通过将此属性设置为 NoCheck.,可以关闭吊销检查。

有关详细信息,请参阅 “使用证书”。

适用于

另请参阅