none
Storing certificates into Trusted Root Certification Authority programmatically RRS feed

  • Question

  • Hi All,
            I have a client certificate(.pfx PKCS12 file) and I want to put that in  Trusted Root Certification Authority. I can always right click on certificate and say install, but I want to do that in programmatic way. How can do this programmatically ? I tried overriding RemoteCertificateValidationCallback(CertificateValidationCallback), that seemed to work for allowing client's certificate on server(by returning true), but this is not working in same way for allowing server's certificate on Client side, just by returning true from that callback routine in client program. Still it say remote i.e. server's certificate is null.

    Thanks in advance,
    Swapnil
    Monday, December 21, 2009 9:14 AM

Answers

All replies

  • Got the solution.
    • Marked as answer by swapnil kamble Wednesday, December 23, 2009 2:17 PM
    Wednesday, December 23, 2009 2:17 PM
  • you can use these APIs
    open file Cert store
    PFXImportCertStore

    Enum Certificates in the Store to get CERT_CONTEXT of specific certificate 
    CertEnumCertificatesInStore

    The you have to open another store (which you want to add cert to)

    CertOpenStore

    and the specific Certificate to the other Store

    CertAddCertificateContextToStore

    Wednesday, January 6, 2010 7:51 AM