Problems with httpclient and selfsigned certificates

我们两清 提交于 2019-12-12 21:24:04

问题


I am sure this has been discussed in this group, but I couldn't find that thread, so bear with it, or if possible merge it with the original.

I am using httpclient for my android app and I have a local site which has a few https pages. Since default httpclient doesnot allow self-signed certificates I am using "EasySSLFactory" and "EasyX509TrustManager", which are mentioned in httpclient documentation.

client = new DefaultHttpClient(); client.getConnectionManager().getSchemeRegistry().register(new Scheme("https", new EasySSLSocketFactory(), 443));

The problem is if I use this SSLFactory in my android app, I am getting correct response from my site's https pages, but I get "SSL handshake failure: I/O error during system call, Unknown error: 0" for sites such as "gmail.com", "ymail.com". If I don't use "EasySSLSocketFactory" I get response from these sites but get exception for my site.

The funny thing is that this page fetch code works fine as a standalone java application.

What could be the problem. Please help me with this.

Thanks and Regards


回答1:


Solved it for now, since I had just one certificate I put it in emulator's keystore. If somebody has better solution, please let me know.



来源:https://stackoverflow.com/questions/3117896/problems-with-httpclient-and-selfsigned-certificates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!