获得证书的名单在C#中的证书存储 [英] Get list of certificates from the certificate store in C#

查看:203
本文介绍了获得证书的名单在C#中的证书存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关安全的应用程序,我需要选择在对话框的证书。
我如何才能获得证书存储区或它的一部分(例如storeLocation =本地计算机和STORENAME =我)使用C#和从那里得到的所有证书的集合?在此先感谢您的帮助。


解决方案

 的X509Store店=新的X509Store(我);store.Open(OpenFlags.ReadOnly);的foreach(X509Certificate2 mCert在store.Certificates){
    // TODO的
}

For a secure application I need to select a certificate in a dialog. How can I access certificate store or a part of it (e.g. storeLocation="Local Machine" and storeName="My") using C# and get a collection of all certificates from there? Thanks in advance for your help.

解决方案

X509Store store = new X509Store("My");

store.Open(OpenFlags.ReadOnly);

foreach (X509Certificate2 mCert in store.Certificates){
    //TODO's
}

这篇关于获得证书的名单在C#中的证书存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆