Hello, we are having the same issue as the one described here:
https://forums.lightstreamer.com/showthread.php?4270-using-a-Self-Signed-SSL-on-Android-Client.
We have tried the solution suggested in the aforementioned post but it doesn't seem to work in my case:
CertificateFactory cf = null;
try {
cf = CertificateFactory.getInstance("X.509");
InputStream caInput = _c.getAssets().open("certificate.cer");
Certificate ca;
InputStream ca2Input = _c.getAssets().open("certificate_CA.cer");
Certificate ca2;
try{
ca = cf.generateCertificate(caInput);
ca2 = cf.generateCertificate(ca2Input);
System.out.println("ca="+((X509Certificate) ca).getSubjectDN());
}finally{
caInput.close();
ca2Input.close();
}
// Create a KeyStore containing our trusted CAs
String keyStoreType = KeyStore.getDefaultType();
KeyStore keyStore =KeyStore.getInstance(keyStoreType);
keyStore.load(null,null);
keyStore.setCertificateEntry("ca", ca);
keyStore.setCertificateEntry("ca2", ca2);
// Create a TrustManager that trusts the CAs in our KeyStore
String tmfAlgorithm = TrustManagerFactory.getDefaultAlgorithm();
TrustManagerFactory tmf =TrustManagerFactory.getInstance(tmfAlgorithm);
tmf.init(keyStore);
// Create an SSLContext that uses our TrustManager
SSLContext context =SSLContext.getInstance("TLS");
context.init(null, tmf.getTrustManagers(),null);
HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
});
HttpsURLConnection.setDefaultSSLSocketFactory(context.getSocketFactory());
[...]
Delving into the client's machinery it seems that it ultimately relies on NettyHttp* classes, but there seems to be no way for us to access/configure SSL policies on that layer. Do you have any suggestions?
Thanks