I'm trying use self-signed certificate (c#):
X509Certificate2 cert = new X509Certificate2(Server.MapPath("~/App_Data/myhost.pfx"), "pass");
on a shared web hosting server and I got an error:
System.Security.Cryptography.CryptographicException: An
internal error occurred.
stack trace ends with
System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr) +33
System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromFile(String fileName, IntPtr password, UInt32 dwFlags, Boolean persistKeySet, SafeCertContextHandle& pCertCtx) +0
System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromFile(String fileName, Object password, X509KeyStorageFlags keyStorageFlags) +237
System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password) +131
On my dev machine it loads ok.
The reason I load *.pfx not a *.cer file because I need a private key access (cer file loads Ok).
I made pfx on my dev mochine like that:
makecert -r -n "CN=myhost.com,
[email protected]" -sky exchange -b 01/01/2009 -pe -sv myhost.pvk myhost.cer
pvk2pfx -pvk myhost.pvk -spc myhost.cer -pfx myhost.pfx -po pass
Please assist;
PS: makecert is a v5.131.3790.0