Monday, July 4, 2016

How to Trust All Certificates for HttpURLConnection in Android

The following code snippet will help you to disables the SSL certificate checking for new instances of HttpsURLConnection in Android.
Note: You can use this code for testing purpose only and remove when moving to production. Trusting all certificate in production will expose your box for hackers.

public void trustAllCertificates() {
try {
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
X509Certificate[] myTrustedAnchors = new...
Posted under . Read full article from Stacktips.
Follow author on twitter https://twitter.com/npanigrahy.

No comments:

Post a Comment