I've created a .Net Core 3.1 application and have the following code in my program class:
var x509Certificate = new X509Certificate2(“test.pfx”, “password”, X509KeyStorageFlags.MachineKeySet);
When the code runs, the following exception occurs: Windowscryptographicexception - 'the specified network password is not correct'
I know the password is correct, so in this case, is there anything else which could be causing the issue?
As part of this work, I had retrieved the password from an old config file, which has to espape an & value with an ampersand. Hence, when I tried, it was actually wrong.
Created my own certificate through pluralsight tool and tested with this and no issues.
Apologies!