I have a SSLSocketFactory and a TrustManagerFactory as shown below:
TrustManagerFactory tmf = TrustManagerFactory.getInstance("X509"); tmf.init(trustStore); LogUtils.log("SSL: did init TrustManagerFactory with trust keyStore"); SSLContext context = SSLContext.getInstance("TLS"); context.init(null, tmf.getTrustManagers(), null); urlConnection.setSSLSocketFactory(context.getSocketFactory()); What are the implications of setting the context TrustManagers to null?
so
changing:
context.init(null, tmf.getTrustManagers(), null); to this:
context.init(null, null, null);
nullfor the trust manager will use the default TrustManager, which might not be an "X509" TM (it's "PKIX" in recent versions of Oracle JREs, not sure about Android), and which might be initialised with a different trust store (since your code doesn't show where you've loaded it from).