Totally agree with @Sid here. Please don't add any spurious klugey code on android to bypass SSL exceptions. Totally defeats the purpose of SSL.
For anyone having issues connecting over https to a tomcat server from android:
Make sure you chain with the root and intermediate certificates of your CA.
I didnt generate the private key used create the CSR for GoDaddy, our CA, so I had to convert the key and certs to pkcs12 before importing into a keystore. Note the -chain option. Its important.
openssl pkcs12 -export -out mykey.pks -inkey private_key.key -in domain.crt -CAfile ca_intermed_root_bundle.crt -chain -name alias_name -passout stdin
(enter password through stdin)
Now, import mykey.pks into a java keystore
keytool -importkeystore -deststorepass changeit -destkeypass changeit -destkeystore mystore.keystore -srckeystore mykey.pks -srcstoretype PKCS12 -alias alias_name
This keystore can now be used in the tomcat 8443 connector:
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="/path../mystore.keystore"
keystorePass="changeit" keyAlias="alias_name"
/>
I was having repeated SSLPeerUnverifiedExceptions when connecting from android and this totally fixed it.
Finally, please verify with http://www.sslshopper.com/ssl-checker.html or any other tool to check if the certificates are chained correctly.