We have an Azure Function (.NET 4.7.2) running for a year that sends messages to a webservice using a client certificate. This certificate has to be renewed but now we have done that we are getting this exception when sending a message;
System.Security.Cryptography.CryptographicException: Invalid provider type specified.
Azure has problems reading the private key and the problem seems to be exporting it from my local machine. Could this problem originate from the original CSR? The previous certificate still works fine, as long as it's valid. Note that I can send messages using the new certificate from my local machine. Things I have tried;
- Using all combinations of MMC settings to export the .pfx file
- Using the answer in https://stackoverflow.com/a/34103154/6033193 to convert the cert key to the RSA format and upload the new resulting .pfx
- Using
CertUtil.exe -store -user my
to compare the new and the old certificate. They both have ProviderMicrosoft Enhanced Cryptographic Provider v1.0
and, apart from the hashes and names, look the same. - Removing Azure Key Vault from the setup and uploading the pfx directly to the app service
- Reading the .pfx from a local folder and using it like this:
new X509Certificate2(certByes, "password", X509KeyStorageFlags.PersistKeySet);
. This works so something seems to be going wrong when uploading the .pfx file to the Azure portal.
Any more things I can try?