![](/img/trans.png)
[英]How to add a certificate to the root trusted certificate but no alert window in C#
[英]How can I get the expiration date of an intermediate certificate and trusted root certificate by C# code?
使用X509Certificate.GetExpirationDateString方法 。
要獲取證書,請使用:
X509Store store = new X509Store(StoreName.Root, StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadOnly);
X509Certificate2Collection certs = store.Certificates.Find(
X509FindType.FindBySubjectDistinguishedName,
"name",
false);
X509Certificate2 cert = certs[0];
cert.GetExpirationDateString();
我沒有包括異常處理和檢查是否清晰。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.