I am developping a .net core application making REST requests to Trello's website. However, at the first request, I get a TlsException: Invalid certificate received from server
raised.
After googling this error, I found a workaround that used the ServicePointManager.ServerCertificateValidationCallback
method. My problem is that ServicePointManager
is not part of .net core. What would be the correct way to validate Trello's certificate, or to bypass the validation step altogether in my environement?
Here is the relevant exception stack trace :
TlsException: Invalid certificate received from server. Error code: 0xffffffff80092012
Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates)
Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 ()
Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process ()
(wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process ()
Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg)
Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult)
Rethrow as IOException: The authentication or decryption has failed.
Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult)
Rethrow as WebException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure
System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult)
System.Net.HttpWebRequest.GetResponse ()
RestSharp.Http.GetRawResponse (System.Net.HttpWebRequest request)
Rethrow as WebException: Trello returned with an error.
Error Message: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure