I can't can't get my self-signed cert to be accepted, I'm using the following method:
HostnameVerifier hostnameVerifier =
org.apache.http.conn.ssl.SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER;
DefaultHttpClient dummy = new DefaultHttpClient();
SSLSocketFactory socketFactory = SSLSocketFactory.getSocketFactory();
socketFactory.setHostnameVerifier((X509HostnameVerifier) hostnameVerifier);
SchemeRegistry registry = new SchemeRegistry();
registry.register(new Scheme("https", socketFactory, 8443));
SingleClientConnManager mgr = new SingleClientConnManager(
dummy.getParams(), registry);
DefaultHttpClient client = new DefaultHttpClient(mgr, dummy.getParams());
// make connection with 'client' now.
My server is listening on 8443 with https, I can verify this with a browser. I'm taking the above from a few other posts on the same subject:
Not sure why it's not working for me, just keep getting a "Not trusted server certificate" exception" upon connection. Any ideas?
Accepting a certificate for HTTPs on Android
Thanks