Is there something similar to setting -D javax.net.debug=ssl
at the command line for Java desktop applications, but for the Android? I\'ve tried setting it in code
you can write a TrustManager class to handle it. example :
ClientConnectionManager cm = new BasicClientConnectionManager();
cm.getSchemeRegistry().register(createHttpsScheme());
DefaultHttpClient client = new DefaultHttpClient(cm);
String url = "https://your domain/your url";
HttpGet get = new HttpGet(url);
HttpResponse resp = client.execute(get);
etc..
public static Scheme createHttpsScheme() {
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, new TrustManager[] {
new TestTrustManager()
}, new SecureRandom());
SSLSocketFactory sf = new SSLSocketFactory(context);
return new Scheme("https", 443, sf);
}
int TestTrustManager.java you can print the chain like this:
public class TestTrustManager implements X509TrustManager {
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
for (int i = 0; i < chain.length; ++i) {
System.out.println(chain[i]);
}
decorated.checkServerTrusted(chain, authType);
}
}