I have a webservice which only allows https and ssl requests. 1&1 generated us an certificate from Geo Trust. (.pfx)
In Android my https request are working with the certificate. It Looks like this:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Ssl3;
using (var mmstream = new MemoryStream())
{
Android.App.Application.Context.Assets.Open("***.pfx").CopyTo(mmstream);
byte[] b = mmstream.ToArray();
X509Certificate2 cert = new X509Certificate2(b, "'''", X509KeyStorageFlags.DefaultKeySet);
clientHandler.ClientCertificates.Add(cert);
}
ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback((sender, certificate, chain, policyErrors) => { return true; });
But in iOS it doesnt work. Heres the Code
HttpClientHandler clientHandler = new HttpClientHandler() { ClientCertificateOptions = ClientCertificateOption.Automatic };
using (var mmstream = new MemoryStream())
{
Assembly ass = Assembly.GetExecutingAssembly();
string[] str = ass.GetManifestResourceNames();
foreach (string resource in str)
{
if (resource.Contains("SSL"))
ass.GetManifestResourceStream(resource).CopyTo(mmstream);
}
byte[] b = mmstream.ToArray();
X509Certificate2 cert = new X509Certificate2(b, "***", X509KeyStorageFlags.DefaultKeySet);
clientHandler.ClientCertificates.Add(cert);
return clientHandler;
}
I always get the error Message The Methode is not implemented. (line clienthandler.clientcertificated.add(cert);).
What am i doing wrong?