开发者

Android and SSL - checking certificate validity

开发者 https://www.devze.com 2023-01-01 23:48 出处:网络
I\'ve got the following code making SSL work with my HttpClient connections and such SchemeRegistry schemeRegistry = new SchemeRegistry();

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消