Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSL certificate validation .NET vs Mono

Tags:

c#

.net

ssl

mono

I have problem with validating SSL certificate in my Unity game.

I have made simple test code which is:

ServicePointManager.ServerCertificateValidationCallback += ServerCertificateValidationCallback;


private static bool ServerCertificateValidationCallback(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
    return true;
}


public void Test()
{
    WebClient w = new WebClient();
    string downloadString = w.DownloadString("https://encrypted.google.com/");
}

I have implemented this in .NET 4.5 and in Unity (Mono) and the problem is that this certificate is validated properly on .NET, but in Mono I'm getting:

SslPolicyErrors: RemoteCertificateChainErrors
ChainStatus:
    PartialChain
    RevocationStatusUnknown
    OfflineRevocation

Why this happens? Should I set something in Mono additionally to handle that?

Thanks

like image 991
Tomasz Avatar asked Dec 13 '16 09:12

Tomasz


People also ask

What is the most stringent form of SSL certificate validation?

EV certificates have the most rigorous SSL validation process and, consequently, offer the highest levels of authentication.

Which type of SSL certificate is best?

Extended Validation (EV) Certificates Extended Validation Certificate follows a strict verification process to a rigorous level and helps to detect phishing websites. Also, it provides a higher level of security than any other type of SSL certificate.

What are the 3 types of SSL?

There are three recognized categories of SSL certificate authentication types: Extended Validation (EV) Organization Validation (OV) Domain Validation (DV)

How is an SSL certificate validation?

The web server sends a copy of the SSL certificate to the browser. The browser checks the authenticity of the certificate and sends a message to the webserver. In return, the webserver/website sends a digitally signed acceptance for initiating an SSL encrypted session.


1 Answers

The problem is mono doesn't carry any Root CA or CRL, see Why doesn’t Mono includes root certificates. And if you try to develop mobile game, there was a cert load bug, which return incomplete X509Chain and was fixed in Mono 3.6.0.

According to official advices, update unity to Unity2017 will built-in mono 4.5 which solved this annoyed problem. Otherwise you may have to install CA certs manually.

like image 167
sakiM Avatar answered Oct 18 '22 19:10

sakiM