I'm working on a .NET Core app where verification of a 3rd party SSL certificate (occurring across a VPN) is failing (the server cert isn't properly signed with a root CA so can't be verified using openssl, which I'm using).
It's easy enough to disable verification for an HttpClient
I manually create. Something like this, as described in bypass invalid SSL certificate in .net core:
using (var httpClientHandler = new HttpClientHandler())
{
httpClientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; };
using (var client = new HttpClient(httpClientHandler))
{
// Make your request...
}
}
In my case though, I'm using a 3rd party DLL to make a connection, so the internals of how it does the request are hidden, and I have no access to disable SSL verification for the connection. Is there a way in .NET Core 3.1 I can completely disable SSL verification for any requests from the application?