我在線模式驗證證書撤銷,但CRL分發點中提到的URL沒有得到命中,如果CRL已被緩存在內存中。我正在使用fiddler來驗證URL是否被訪問。我正在執行這些步驟。問題X509RevocationMode.Online在撤銷證書驗證
- 運行提琴手。
- 開始證書驗證
X509RevocationMode.Online
- 驗證小提琴手,CRL分發點中提到的網址沒有被捕獲。
- 從內存中清除在
X509RevocationMode.Online
- 的CRL由命令
certutil -urlcache CRL delete
- 開始證書驗證現在提琴手陷入CRL分發點中提到的URL。
從上面的步驟可以明顯看出,只有當CRL沒有被緩存時,CRL的URL纔會被命中。現在我的問題是:
- 在線模式下訪問CRL分發點中的URL提及的情況是什麼?
- 如果CRL已被緩存,X509Certificate如何驗證CRL是否已更新或沒有點擊URL?
- 我是否錯過了CRL的概念?
這裏是我的代碼
private void BuildCertificateChain(X509Certificate2 certificate)
{
string error = null;
X509Chain certificateChain = new X509Chain();
certificateChain.ChainPolicy.RevocationFlag = X509RevocationFlag.EntireChain;
certificateChain.ChainPolicy.VerificationTime = DateTime.Now;
certificateChain.ChainPolicy.RevocationMode = X509RevocationMode.Online;
certificateChain.ChainPolicy.UrlRetrievalTimeout = new TimeSpan(0, 0, 15);
try
{
if (certificateChain.Build(certificate))
{
foreach (X509ChainElement element in certificateChain.ChainElements)
{
Trace.WriteLine(string.Format("Issuer = {0}\nSubject = {1}", element.Certificate.Issuer, element.Certificate.Subject));
element.Certificate.Verify();
}
}
else
{
error = string.Format("File {0} digital signature seems to be not valid due to a certificate in certificate chain being revoked. Revocation reasons are:\n", filename);
foreach (X509ChainStatus status in certificateChain.ChainStatus)
{
error += status.StatusInformation;
}
}
}
catch (Exception ex)
{
error = string.Format("Exception building certificate chain for executing application {0}. The error is {1}", _executingAppFileName, ex.Message);
}
if (!string.IsNullOrEmpty(error))
{
//SetError(error);
}
}
}
請記住,upvote有用的答案,並「檢查」最好的回答你的問題。 – 2013-05-10 09:55:29
別擔心,欣賞是我的習慣......但讓我明確所有疑問。 :) – PawanS 2013-05-10 10:25:58