Invalid certificate received from server. Error code: 0xffffffff800b010a Mono

4.3k Views Asked by At

I'm trying to send a message in Mono througth my application using the port 587 with the SSL, smtp.gmail.com and get:

System.Net.Mail.SmtpException: Message could not be sent. ---> System.IO.IOException: The authentication or decryption has failed. ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server. Error code: 0xffffffff800b010a

The most interesting is that that week everything worked and the messages were sent. Now I get a mistake. Also I tryed mozroots --import but it doesnt help. Also I updated certificate GoogleInternetAuthorityG2.crt but and this doesnt help.

Ubuntu 16.04 with Mono 4.6.2 (Stable 4.6.2.7/08fd525)

2

There are 2 best solutions below

2
knocte On BEST ANSWER

Mono 4.8 or higher brings a new TLS stack that supports many more encryption algorithms, please upgrade.

3
Küzdi Máté On

Try this before sending the message (It is kind of a hack, but on Mono this is the only thing that worked for me..)

ServicePointManager.ServerCertificateValidationCallback =
    delegate(object s, X509Certificate certificate,
             X509Chain chain, SslPolicyErrors sslPolicyErrors)
    { return true; };