Csharp/C#教程:如何以编程方式删除受信任的根证书颁发机构中的证书?分享


如何以编程方式删除受信任的根证书颁发机构中的证书?

我需要能够从组织中的每台PC上删除特定证书。 是的,我可以坐到座位,但我要到星期四才能把它拉下来,我没有人力去坐下。

是否有一种使用C#的程序化方法?

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

如果你真的想在今天写一些C#来做这个,那么看看X509Store.Remove

在MSDN中有一个例子( 点击这里 )

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

上述就是C#学习教程:如何以编程方式删除受信任的根证书颁发机构中的证书?分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!

 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 (); } } 

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/cdevelopment/949988.html

(0)
上一篇 2021年11月18日
下一篇 2021年11月18日

精彩推荐