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設定為 關閉撤銷檢查。
如需詳細資訊,請參閱使用憑證。