I’ve run into this issue about a billion times. Mostly, I see it when I’m coding against a web API on a device with a bad or partially-valid self-signed cert.
I’ve seen several articles on how to disable the SSL validation check, but have had only limited success with them. I finally found an approach out there that works for all of my use cases, and wrapped a nice function around it. I’m publishing it here in hopes it helps people out someday.
Basically, call this either to enable or disable SSL certificate validation. It is safe to run multiple times in the same session and doesn’t throw any errors.
Here it is: