I try to generate key from this code
CngKey key = CngKey.Import(Convert.FromBase64String(privateKey), CngKeyBlobFormat.Pkcs8PrivateBlob);
it works fine locally but when I deploy in my Azure app service. it gives me this error:
System.Security.Cryptography.CryptographicException: The system cannot find the file specified. at System.Security.Cryptography.NCryptNative.ImportKey(SafeNCryptProviderHandle provider, Byte[] keyBlob, String format) at System.Security.Cryptography.CngKey.Import(Byte[] keyBlob, String curveName, CngKeyBlobFormat format, CngProvider provider)
I add WEBSITE_LOAD_USER_PROFILE In Configuration with value '1' but it didn't make any difference.
Thanks
I upgraded the plan service from free to basic with adding WEBSITE_LOAD_USER_PROFILE = 1 in Azure Configuration.
The issue was when the app service was free it use a shared VM but when upgrading my app service pricing into basic it use a private VM.
If WEBSITE_LOAD_USER_PROFILE = 1 does not work for you. Here is a workaround for this same issue:
Check out the below links for the similar issue for reference:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With