X509Certificate.CreateFromCertFile - the specified network password is not correct

前端 未结 7 1171
你的背包
你的背包 2020-12-14 16:23

I have a .NET application that I want to use as a client to call an SSL SOAP web service. I have been supplied with a valid client certificate called foo.pfx. T

7条回答
  •  隐瞒了意图╮
    2020-12-14 16:38

    In my case I was trying to run in the Private Application mode and I got the same error.

    The specified network password is not correct

    The PrivateAuthenticator constructor (in Xero.Api.Example.Applications.Private) was trying to import the certificate assuming there is no password defined during the creation of the certificate.

    _certificate = new X509Certificate2();
    _certificate.Import(certificatePath);
    

    Then I changed the import to use an overload method which uses the password,

    _certificate.Import(certificatePath, "mypasswordusedtocreatethecertificate",  X509KeyStorageFlags.MachineKeySet);
    

提交回复
热议问题