【问题标题】:How do I programmatically remove a certificate in Trusted Root Certification Authorities?如何以编程方式删除受信任的根证书颁发机构中的证书?
【发布时间】:2010-10-13 17:24:18
【问题描述】:

我需要能够从我组织中的每台 PC 中删除特定证书。是的,我可以一个座位到另一个座位,但我要到星期四才能完成,而且我没有人力去一个座位到座位。

是否有使用 C# 的编程方式来执行此操作?

【问题讨论】:

    标签: c# internet-explorer digital-certificate certificate-authority


    【解决方案1】:

    我认为您不需要编写任何 C# - 看看 certmgr.exe /del

    如果你今天真的确实想写一些 C# 来做到这一点,那么看看X509Store.Remove

    【讨论】:

    • 我正在查看那些页面。不幸的是,他们没有告诉我如何访问(如果有的话)“受信任的根证书颁发机构”。我不知道怎么去那家商店。
    • 受信任的根证书颁发机构存储只是称为“根”。或者你是说你有“权限被拒绝”的问题?
    • 不..我不知道它被称为ROOT。这解决了一切。杀死你的是小细节。
    【解决方案2】:

    在 MSDN 中有一个例子 (click here)

    我认为这个例子是不言自明的,但摘录如下:

    using System;
    using System.Security.Cryptography;
    using System.Security.Cryptography.X509Certificates;
    using System.IO;
    
    public class X509store2
    {
        public static void Main (string[] args)
        {
            //Create new X509 store called teststore from the local certificate store.
            X509Store store = new X509Store ("ROOT", StoreLocation.CurrentUser);
            store.Open (OpenFlags.ReadWrite);
    
            ...
    
            store.Remove (certificate1);
            store.RemoveRange (collection);
    
            ...
    
            //Close the store.
            store.Close ();
        }    
    }
    

    【讨论】:

    • 问题正在寻求将其从受信任的根证书存储中删除。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-04-11
    • 2011-12-11
    • 1970-01-01
    • 2014-07-13
    • 1970-01-01
    • 2014-12-25
    • 2018-07-30
    相关资源
    最近更新 更多