0

The server mode SSL must use a certificate with the associated private key.

I have my Base64-encoded .crt file and another huge text file with lots of info, from my certificate provider, which includes the private RSA key in an equivalent format.
I tried putting that in a .pvk file to later make the .pfx one, and it didn't work. (nice try, right?)
What do I need to actually do to use this certificate to use SSL in my .NET application?

Edit: Made a proper .pvk, made the .pfx, still, same error.

Vercas
  • 8,931
  • 15
  • 66
  • 106
  • What code are you using so far? How did you try to make the PFX file and how specifically did it "not work"? Is there some reason you can't/won't install the certificate using CertMgr.msc? – EricLaw Aug 16 '13 at 13:59
  • The *.pvk* with text didn't work. The certificate itself doesn't include the private key. – Vercas Aug 16 '13 at 14:22
  • 1
    When you install the PFX file in CertMgr.msc, the private key is imported as well. – EricLaw Aug 19 '13 at 19:08

1 Answers1

1

I finally solved this. I had to use System.Security.Cryptography.X509Certificates.X509Certificate2 with the .pfx file. The simple X509Certificate didn't seem to work.

Vercas
  • 8,931
  • 15
  • 66
  • 106
  • 3
    The plain X509Certificate only works if there's an associated private key installed in the Windows certificate manager. – EricLaw Aug 19 '13 at 19:08
  • 1
    Having to import that manually in every machine that runs the server software is just redundant. Using the `X509Certificate2` is the best solution in my case. – Vercas Sep 05 '13 at 19:45