신뢰할 수있는 루트 인증 당국에서 인증서를 프로그래밍 방식으로 제거하려면 어떻게해야합니까?
-
19-08-2019 - |
문제
조직의 각 PC에서 특정 인증서를 제거 할 수 있어야합니다. 그렇습니다. 나는 좌석으로 앉을 수 있었지만 목요일까지 그것을 뽑아 내야하며, 좌석으로 갈 수있는 인력이 없습니다.
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 ();
}
}
제휴하지 않습니다 StackOverflow