1
我的IIS(Web服務器)要求客戶端證書,我需要檢查證書的有效性和讀取數據庫的一些信息和記錄(審計)檢查證書有效期使用HttpClientCertificate與X509Certificate2
我有以下代碼
using System.Security.Cryptography.X509Certificates;
...
HttpClientCertificate cert = Request.ClientCertificate;
if (cert.IsPresent && cert.IsValid) {
X509Certificate2 cer = new X509Certificate2(cert.Certificate);
bool verified = cer.Verify();
...
AuditLog(...);
}
cert.IsValid
顯示證書有效。我是否需要實例化X509Certificate2對象並重新檢查證書的有效性(爲什麼)?