簡體   English   中英

如何以編程方式刪除受信任的根證書頒發機構中的證書?

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

我需要能夠從組織中的每台 PC 中刪除特定證書。 是的,我可以 go 座位到座位,但我必須到星期四才能完成,而且我沒有人力來 go 座位到座位。

有沒有使用 C# 的編程方式?

我認為您不需要制作任何 C# - 看看certmgr.exe /del

如果你今天真的想寫一些 C# 來做到這一點,那么看看X509Store.Remove

MSDN中有一個例子( 點擊這里

我認為這個例子是不言自明的,但摘錄如下:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM