Search code examples
.netpfx

Open pfx certificate container in .NET


Where can I find information on opening a PFX store which contains a certificate? I came across this, however I am kind of loast at the PfxOpen Class.

Edit - I have a pfx file exported with a private key. I am storing that in my database. I want to be able to open the pfx file and read information from the certificate contained in that pfx file, example the serial, expiration date etc.


Solution

  • X509Certificate2 cert = new X509Certificate2(filename, password)

    from there you can see what's in the cert. the X509Certificate2 has many overloads. check it out.