Skip to content

Instantly share code, notes, and snippets.

@diegolovison
Created February 24, 2025 18:40
Show Gist options
  • Save diegolovison/49133765475d3ec6fa91560309b16edf to your computer and use it in GitHub Desktop.
Save diegolovison/49133765475d3ec6fa91560309b16edf to your computer and use it in GitHub Desktop.
SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, new TrustManager[] {
new X509ExtendedTrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType, Socket socket) throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType, Socket socket) throws CertificateException {
}
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType, SSLEngine engine) throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType, SSLEngine engine) throws CertificateException {
}
}
}, new SecureRandom());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment