This project is read-only.

Certificates on Mono (Mac) when using WebSocket

Sep 9, 2015 at 10:41 AM
Edited Sep 9, 2015 at 10:44 AM

I am trying to create some sort of Push manager, client side, that will listen to what the server has to say.

Nothing hard so... I have written it PC side, thanks to WebSocket4Net, on C#, and it works perfectly.

But here is the issue...: my application has to work on Mac too, using the same code. I use Mono obviously, and the WebSocket4Net lib works. Unfortunately, every time I try to open a socket, I have a nice "RemoteCertificateNotAvailable", followed by a "Invalid certificate received from server".

Here is what I have tried, following some advices from the web:
WebSocket webSocket = WebSocket("URI");
webSocket.AllowUntrustedCertificate = true;
System.Net.ServicePointManager.ServerCertificateValidationCallback = ValidationCallback; <- returns true;
I don't know why these solutions do not work. Other posts say this should work, and I have no idea why it doesn't here (maybe because it only works with System.Net lib?).

It CAN work by manually adding trusted certificates to Mono (mozroots --import --sync), or with certmgr, or something like that. But I don't want this solution, as it needs to work on any other computer than mine without installing anything. I can accept running some command in my application that will install some certificates... Let's say I am interested in these solutions. But I would rather find a solution implying some lines of C# code.

So... Does anyone have an idea on how to bypass this problem?
Marked as answer by MatthieuD on 9/9/2015 at 3:19 AM
Sep 9, 2015 at 11:19 AM
Solved by commit of 4th of August!
I was on the problem since a couple months, didn't see the latest update.