Skip to content

Instantly share code, notes, and snippets.

@SeongUgJung
Created October 5, 2015 06:57
Show Gist options
  • Save SeongUgJung/e9feed6ff82de6122bba to your computer and use it in GitHub Desktop.
Save SeongUgJung/e9feed6ff82de6122bba to your computer and use it in GitHub Desktop.
All_Trust_SSLContext
private SSLContext getSSLContext() throws KeyManagementException, NoSuchAlgorithmException {
SSLContext context = SSLContext.getInstance("SSL");
context.init(null, new TrustManager[]{new X509TrustManager() {
public void checkClientTrusted(X509Certificate[] x509Certificates, String authType) throws CertificateException {
}
public void checkServerTrusted(X509Certificate[] x509Certificates, String authType) throws CertificateException {
}
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
}
}, new SecureRandom());
return context;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment