pfx 证书错误 "The specified network password is not correct."

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

我正在尝试 运行 一个使用 pfx 证书访问 API 的控制台应用程序,但出现以下错误。

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

运行 该应用程序可在我的本地计算机和同事的计算机上运行。 pfx 文件创建时没有密码,因此不需要密码。当我们尝试在服务器 运行ning Windows Server 2012 上 运行 它时,它说特定的网络密码不正确。

我尝试在服务器上安装证书,当我尝试从要求输入密码的 window 继续时,它响应“您输入的密码不正确。”。我再次尝试在我的本地机器上安装它,它允许我在没有密码的情况下通过密码 window。

我尝试将 .key 和 .pem 文件添加到与 pfx 文件相同的文件夹中,但也没有成功。

我们尝试使用 Windows Server 2019 在我们的一台服务器上安装证书并且它有效。在我们尝试过之后,我看到了上面罗伯特的评论,看来他是对的。谢谢罗伯特。

Windows 2012 已过时,不适用于 PFX 文件。解决方案将转到较新的 Windows 服务器。