X509ClientCertificateAuthentication.RevocationMode 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置 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
属性值
X509RevocationMode 中的值之一:NoCheck
、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 可关闭吊销检查。
有关详细信息,请参阅使用证书。