I've got the following code making SSL work with my HttpClient connections and such
SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("https",
SSLSocketFactory.getSocketFactory(), 443));
HttpParams params = new BasicHttpParams();
SingleClientConnManager mgr = new SingleClientConnManager(params, schemeRegistry);
HttpClient client = new DefaultHttpClient(mgr, params);
However, does this actually validate the cert? It seems like 开发者_开发技巧there should be more to it.
Nevermind, the above code does indeed validate the certificate. I tried it with some random self signed certs for different sites, and it failed.
精彩评论