Tell me more ×  I'm trying to make Https connections on the
Android phones, using HttpClient. Trouble is that since the
certificate isn't signed I keep getting " Not trusted server
certificate".  Now I've seen a bunch of solutions where you
simply accept all certificates, but what if I want to ask the
user? I want to get a dialog similar to that of the browser,
letting the user decide to continue or not.  Preferably I'd like
to use the same certificatestore as the browser. Any ideas?
share|improve this question add comment  5 Answers  up vote 68
down vote accepted  The first thing you need to do is to set the
level of verification. Such levels is not so much:   Although
the method setHostnameVerifier() is obsolete for new library
apache, but for version in Android SDK is normal. And so we take
ALLOW_ALL_HOSTNAME_VERIFIER and set it in the method factory
SSLSocketFactory.setHostnameVerifier().  Next, You need set our
factory for the protocol to https. To do this, simply call the
SchemeRegistry.register() meth