3

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)

knocte
  • 16,941
  • 11
  • 79
  • 125
ruslanen
  • 69
  • 2
  • 11

2 Answers2

5

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

knocte
  • 16,941
  • 11
  • 79
  • 125
3

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; };
Küzdi Máté
  • 661
  • 8
  • 12
  • 3
    this is an important security risk, please avoid this if you can – knocte Apr 25 '17 at 16:45
  • 1
    Needed this to get past a Google Sign-in hurdle, though I'm setting it right back to it's previous value after I'm done in case it exposes too many risks. – chamberlainpi Jun 15 '17 at 17:55
  • The error message states "the authentication or decryption has failed". This workaround applies to the former (authentication failure), but not the latter (decryption failure). YMMV. – MattDavey Jan 09 '18 at 13:26