Dan
Dan

Reputation: 333

Error with pfx certificate "The specified network password is not correct."

I am trying to run a console application that accesses an API using a pfx certificate and I am getting the following error.

2022-03-21 11:25:22.0244 - ERROR: Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException: The specified network password is not correct. at Internal.Cryptography.Pal.CertificatePal.FilterPFXStore(ReadOnlySpan'1 rawData, SafePasswordHandle password, PfxCertStoreFlags pfxCertStoreFlags) at Internal.Cryptography.Pal.CertificatePal.FromBlobOrFile(ReadOnlySpan'1 rawData, String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags) at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags) at ADP_API.APICall.GetHttpClientHandler() in E:\repos\ADP_API\ADP_API\APICall.cs:line 315 at ADP_API.APICall.Authenticate() in E:\repos\ADP_API\ADP_API\APICall.cs:line 79

Running the application works on my local machine and my co worker's machine. The pfx file was created with no password therefore doesn't require one. When we try to run it on a server running Windows Server 2012 it says the specific network password is not correct.

I tried installing the certificate on the server and when I try to continue from the window that asks for a password, it responds with "The password you entered is incorrect.". I tried installing it on my local machine again and it allows me to pass through the password window with no password.

I tried adding the .key and .pem files in the same folder as the pfx file and no luck with that either.

Upvotes: 3

Views: 9353

Answers (3)

user121209
user121209

Reputation: 31

It worked!

openssl pkcs12 -export -certpbe PBE-SHA1-3DES -keypbe PBE-SHA1-3DES -nomac -out OUTPUT_FILE.pfx -inkey KEY_FILE.key -in CERTIFICATE.crt -certfile INTERMEDIATE.pem

Upvotes: 3

nrod
nrod

Reputation: 398

This is not really an answer but I would like to highlight the comment from https://stackoverflow.com/users/2152973/fran%c3%a7ois-breton that led to fix my problem.

Using a recent version of openssl 1.1.1 made it work.

I was having this issue with a .pfx file made in Ubuntu with openssl 3.0.2 that was not being accepted in Azure.

Upvotes: 3

Dan
Dan

Reputation: 333

We tried installing the certificate on one of our servers with Windows Server 2019 and it worked. After we tried this I saw Robert's comment above and it appears he is correct. Thank you Robert.

Windows 2012 is outdated and won't work for a PFX file. Solution is going to a newer Windows Server.

Upvotes: 2

Related Questions