Skip to content

Instantly share code, notes, and snippets.

@brianhsu
Created November 5, 2015 08:59
Show Gist options
  • Save brianhsu/8cca792e8357ea6419d5 to your computer and use it in GitHub Desktop.
Save brianhsu/8cca792e8357ea6419d5 to your computer and use it in GitHub Desktop.
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, new X509TrustManager[]{new X509TrustManager(){
public void checkClientTrusted(X509Certificate[] chain,
String authType) throws CertificateException {}
public void checkServerTrusted(X509Certificate[] chain,
String authType) throws CertificateException {}
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}}}, new SecureRandom());
http://www.igniterealtime.org/builds/smack/docs/latest/javadoc/org/jivesoftware/smack/ConnectionConfiguration.Builder.html#setCustomSSLContext%28javax.net.ssl.SSLContext%29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment