We are receiving an error System.Security.Cryptography.CryptographicException 'The specified network password is not correct' while trying to load a .pfx file using the X509Certificate2 class from an ASP.NET web application.
The code looks like the following:
X509Certificate2 cert = new X509Certificate2("C:\\Shared\\SAML\\Test Applications\\SAML2IDP\\TcCert.pfx", "password", X509KeyStorageFlags.MachineKeySet);
I created a test certificate using makecert, a private key, and then created the .pfx that i want to read in in code.
What are some reasons why this error would be happening. I'm sure that there must be something I am missing or a step I am forgetting.
I tried giving the ASPNET user permission to the directory where the .pfx file resides, which is actually in my web application root at the moment.
Actually, I temporarily added Everyone permissions to the directory and still received the error ...
Go to the complete details ...