Restsharp Xamarin Component does absolutely nothing - SSL certificate issue?

582 views
Skip to first unread message

René Ruppert

unread,
Nov 9, 2013, 11:43:27 AM11/9/13
to rest...@googlegroups.com
I'm on  Mac OS and use Xamarin Studio with an iOS and a Mono console project.

I've setup a bucket on Runscope to test Restsharp.

My initial test was to use a simple HttpClient:


var httpClient = new HttpClient();
var response = await httpClient.GetAsync(new Uri("
https://api-github-com-pkd7mprw625m.runscope.net"));
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine("Body: " + body);

This fails with an exception:

System.Net.WebException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: The authentication or decryption has failed.

So I presumed it must be a problem with the SSL certificates and I added the ServerCertificateValidationCallback and return TRUE in all cases. Does not help. Mono still complains with the exception above.  
If I execute the same code on a Windows machine in Visual Studio, I get the expected response from Github and also I can see the request on Runscope. It even works WITHOUT the certificate callback!

Next test was to use Restsharp then in an iOS project. I added the certificate validation straight away.

ServicePointManager.ServerCertificateValidationCallback +=
                    (sender, certificate, chain, sslPolicyErrors) => true;

var client = new RestClient("https://api-github-com-pkd7mprw625m.runscope.net");

var request = new RestRequest("/", Method.GET);

IRestResponse response = client.Execute(request);
var content = response.Content;
Console.WriteLine ("Response: " + content);
  

The code above does nothing at all. Response is empty, no error, no exception.

It does not matter what web service I try to contact. None is working in Mono.

Does anybody have an idea?

Can somebody maybe test?

Best regards,

René
Reply all
Reply to author
Forward
0 new messages