I have an RSA private key file, without a password, and a certificate file. I can successfully use those with curl via curl -E file.crt --key file.key .... and the call succeeds. Now I want to do that from C# but it throws an exception of:
The provided data is tagged with 'Universal' class value '16', but it should have been 'Universal' class value '2'.
I'm trying to decode like so:
var key = File.ReadAllText(path)
.Replace("-----BEGIN RSA PRIVATE KEY-----", string.Empty)
.Replace("-----END RSA PRIVATE KEY-----", string.Empty)
.Replace("\n", string.Empty);
using var rsa = RSA.Create();
rsa.ImportRSAPrivateKey(Convert.FromBase64String(key), out _);