【问题标题】:physical path for personal certificate store个人证书存储的物理路径
【发布时间】:2012-11-30 16:38:21
【问题描述】:

这似乎是一个不常见的话题,因为我找不到任何参考。

数字证书存储在商店中。

如你所见...

How do I programmatically remove a certificate in Trusted Root Certification Authorities?

个人数字证书存储在哪里? 商店名称是我的,我们可以在这里看到:

http://msdn.microsoft.com/en-us/library/system.security.cryptography.x509certificates.storename.aspx

但我需要找到文件本身的位置才能以编程方式操作证书。

编辑

我也在尝试以这种方式打印我的证书名称和路径,但我什么也没打印:

X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
X509Certificate2Collection storecollection = 
      (X509Certificate2Collection)store.Certificates;

Console.WriteLine("Store name: {0}", store.Name);
Console.WriteLine("Store location: {0}", store.Location);
foreach (X509Certificate2 x509 in storecollection)
{
  Console.WriteLine("certificate name: {0}",x509.Subject);
}

【问题讨论】:

    标签: c# asp.net .net asp.net-mvc asp.net-mvc-4


    【解决方案1】:

    据我所知,没有个别证书的物理文件。

    关于第二个问题:你错过了Openstore.Open(OpenFlags.ReadWrite); 这样的电话。请参阅 MSDN X509Store 上的完整示例。

    【讨论】:

    • 谢谢阿列克谢。但是,如果没有物理路径,我该如何以程序方式删除证书?微软在这里说: X509Certificate2 certificate1 = new X509Certificate2 ("c:\\mycerts\*****.cer"); ... store.Remove (certificate1);我应该如何指向我的证书?
    • @GuilhermeLongo,我相信来自store.Certificates 的人可以与Remove 通话。喜欢store.Remove(store.Certificates.First());
    猜你喜欢
    • 1970-01-01
    • 2016-04-20
    • 1970-01-01
    • 2019-04-20
    • 2023-02-23
    • 2012-07-24
    • 2021-11-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多