X509Certificate2 The specified network password is not correct

0
I am getting an error on this line. X509Certificate2 cert = new X509Certificate2(fileName.pfx, password, X509KeyStorageFlags.PersistKeySet); *System.Security.Cryptography.CryptographicException: The specified network password is not correct* The above code works in my local windows 10, but not on the Windows server 2012.. I have tried the following resolution that worked for others. Tried with different X509KeyStorageFlags properties. changed code to get the certificate from store instead of the file. Also, What is the correct way to generate the pfx file?
 
asked 1/13/2022 4:41:27 PM
add a comment

2 Answers

0
This worked, Thanks for reply.
edited 1/14/2022 5:17:21 PM
answered 1/14/2022 2:19:55 PM
add a comment
0
Hi NKosuru, Looks like on server the X509Certificate2 constructor tries to access the private key store of the local user (even when loading a PFX and the private key is in the PFX). Please change pfx file encryption to TripleDES-SHA1
 
answered 1/13/2022 6:15:19 PM
add a comment

Your Answer

Not the answer you're looking for? Browse other questions tagged saml or ask your own question.