【发布时间】:2010-10-13 17:24:18
【问题描述】:
我需要能够从我组织中的每台 PC 中删除特定证书。是的,我可以一个座位到另一个座位,但我要到星期四才能完成,而且我没有人力去一个座位到座位。
是否有使用 C# 的编程方式来执行此操作?
【问题讨论】:
标签: c# internet-explorer digital-certificate certificate-authority
我需要能够从我组织中的每台 PC 中删除特定证书。是的,我可以一个座位到另一个座位,但我要到星期四才能完成,而且我没有人力去一个座位到座位。
是否有使用 C# 的编程方式来执行此操作?
【问题讨论】:
标签: c# internet-explorer digital-certificate certificate-authority
我认为您不需要编写任何 C# - 看看 certmgr.exe /del。
如果你今天真的确实想写一些 C# 来做到这一点,那么看看X509Store.Remove。
【讨论】:
在 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 ();
}
}
【讨论】: