Search code examples
c#pfxpkcs#12

Decode a PKCS#12 file


I am looking for ways to decode a PKCS#12 file in .NET, I need to extract the private key and any certificates so that i can programatically access the following.

  • modulus
  • publicExponent
  • privateExponent
  • prime1
  • prime2
  • exponent1
  • exponent2
  • coefficient

I need this informatio so that i can successfully use PKCS#11 to create a private key and cetificate on a USB token.

I have found a website that uses OpenSSL to output this data. I was pretty excited when I found OpenSSL.NET however the functionallity to split PKCS#12 files hasn't been implemented yet. I was wondering if anyone knew of any altenatives.

Thanks

Rohan


Solution

  • I've used bouncy castle API extensibly on a recent project, on its Java port, and it works wonders, flawlessly.

    I bet their C# isn't much different, and it does a really good work at what is targeted.

    http://www.bouncycastle.org/