Skip to content

Instantly share code, notes, and snippets.

@andrewgilmartin
andrewgilmartin / SSLUtilities.java
Created March 9, 2022 20:58 — forked from bekce/SSLUtilities.java
Ignore SSL/TLS trust/certificate errors in Java. Call SSLUtilities.trustAllHttpsCertificates() at init
package utils;
import java.security.GeneralSecurityException;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;