[Solved] Visual Studio – “Invalid provider type specified” CryptographicException when trying to load private key of certificate

 

If You have a code signing certificate issued to you by a commercial CA  and unfortunately, the Visual Studio ClickOnce manifest code signing tool only supports the older CSP/CrytoAPI keys for signing these manifests or return during publishing the error: “An error occurred while signing: Invalid provider type specified, then to solve problem You have to perform a few steps presented below. It is easiest way to solved this problem by using openssl. The procedure is as follows:

  • 1. convert the source PFX to PEM
  • 2. convert the PEM back to PFX

Example:

openssl pkcs12 -in mycert-cng.pfx -out mycert.pem
openssl pkcs12 -export -in mycert.pem -out mycert-cryptoapi.pfx

 

March 30th, 2018