如何使用c#从Windows商店枚举智能卡相关证书?

时间:2016-03-18 06:52:42

标签: c# cryptography

store = new X509Store("MY", StoreLocation.CurrentUser);
                store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
//
// Retrieve the certificates from the store.
//
X509Certificate2Collection collection = (X509Certificate2Collection)store.Certificates;

//
// Find all the certificates of the store.
//
fCollection_Date = (X509Certificate2Collection)collection.Find(
                                                               X509FindType.FindByTimeValid,
                                                               DateTime.Now,
                                                               false);
//
// Display the listed certificates in the UI form
//
sCollection = X509Certificate2UI.SelectFromCollection(
                                                     fCollection_Date,
                                                     "Select Certificate",
                                                     "Select a certificate from the following list to get information on that certificate",
                                                      X509SelectionFlag.SingleSelection);

以下代码将在Windows证书存储区中找到证书,并按时间有效性列出证书。

是否有任何方法可以列出仅与智能卡相关的证书。

0 个答案:

没有答案