c# Revocate certificate in CA using CERTADMINLib

1 Add certadmin lib
enter image description here
For this install http://www.microsoft.com/en-us/download/details.aspx?id=7887

Follow these steps:
1.        Click Start , click Control Panel , and then click Programs .
2.        In the Programs and Features area, click Turn Windows features on or off .
If you are prompted by User Account Control to allow the Windows Features dialog box to open, click Continue .
3.        In the Windows Features dialog box:

Expand Remote Server Administration Tools .
Expand Role Admin Tools .
Expand Active Directory Certificate Services Tools .
Check Certificate Authority Tools.

In command prompt type this: "tlbimp certadm.dll"

Usefull links about this

2 Use this code
public static void RevokeCert(string connection,string serial)
    //connection= "\\My-CA"
    //serial = "614870cd000000000014"

    const int CRL_REASON_UNSPECIFIED = 0;

    CERTADMINLib.CCertAdmin _admin = null;
        _admin = new CCertAdmin();
        _admin.RevokeCertificate(connection, serial, CRL_REASON_UNSPECIFIED, DateTime.Now);
        if (_admin != null)

No comments:

Post a Comment