In the application I'm working on, I have to make an HTTPS connection to the web server. I received certificates without trusted errors and after consulting stackoverflow, I found this blog post: http://blog.antoine.li/index.php/2010/10/android-trusting-ssl-certificates/
It seems that the CA for this server is not included in the default Android storage. In a nutshell, I downloaded all the certificates, created a keystore with the BKS provider, imported the keys, imported the keystore into my project, subclassed the DefaultHttpClient class to force it to use my keystore.
After following the steps on the blog, it worked great on an emulator. However, when I test it on the device, it is interrupted intermittently. I think I highlighted the template. It seems like after some time has passed, and I'm trying to make an HTTPS connection, this will fail. Then, if I try to make the same connection again, it will succeed. If I wait a while, and then try again, this fails for the first time, I can try again. Perhaps I will fix this by simply making several attempts at failure, but I would like to know what is going on. Behavior offers some kind of cache, but I don't know how to find it or change its behavior. Does anyone have any suggestions on what's happening or know what I'm doing wrong? Any help would be appreciated.
source share