I am trying to run an HTTPS Server on an Android device using NanoHttpd (my final goal is to run WSS server on Android). I successfully ran HTTP Server and Websocket using NanoHttpd on Android. I generated the key on MAC using this command and copied it onto my device:
keytool -genkey -keystore key.keystore -storepass keypass -storetype BKS -provider org.bouncycastle.jce.provider.BouncyCastleProvider
I wrote the following code:
keyStore = KeyStore.getInstance("BKS");keyStore.load(stream, keyStorePwd.toCharArray());keyManagerFactory = KeyManagerFactory .getInstance(KeyManagerFactory.getDefaultAlgorithm());keyManagerFactory.init(keyStore, keyStorePwd.toCharArray());SSLContext sc = SSLContext.getInstance("TLS");sc.init(keyManagerFactory.getKeyManagers(), null, null);server.makeSecure(sc.getServerSocketFactory());server.start();
I tested this on Chrome 38 and 42 with "Minimum SSL/TLS" flag set to "SSLv3". But when I want to connect to the server I keep receiving "ERR_SSL_VERSION_OR_CIPHER_MISMATCH" error.
I tried different instances of protocol (SSL/TLS), on multiple machines, and browsers. I tried NanoHttpd SSLServerSocketFactory method. But the error is the same.
I already looked at some samples including:https://github.com/NanoHttpd/nanohttpd/issues/139
Does anyone have any comment on this?