how use a .key file private key in Xamarin iOS?
I try import with SecKey.Create but not work. Dont want save in keychain, only make a signature with a private key .key in base64
I try this code in Xamarin Android and work fine. How replicate that in Xamarin.iOS using SecKey class.
PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(Convert.FromBase64String(key));
KeyFactory kf = KeyFactory.GetInstance("RSA");
var privateKey = kf.GeneratePrivate(spec);
X509EncodedKeySpec spec1 = new X509EncodedKeySpec(Convert.FromBase64String(pub));
KeyFactory kf1 = KeyFactory.GetInstance("RSA");
var pubKey = kf1.GeneratePublic(spec1);
var hash = Convert.FromBase64String(challenge);
var providers = Security.GetProviders();
Signature s = Signature.GetInstance("SHA256withRSA/PSS");
s.InitSign(privateKey);
s.Update(hash);
byte[] signature = s.Sign();