NanoHttpd / nanohttpd

Tiny, easily embeddable HTTP server in Java.

Home Page:http://nanohttpd.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

https server

wasimshariff11 opened this issue · comments

I created https server by generating .bks file, but when I hit request form web application I get handshake failed, web application doesn't have client certificate as it is one way authentication. How can we achieve https with only server side certificate.

KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); InputStream keyStoreStream = FinancialApplication.getApp().getApplicationContext().getAssets().open("keyforssl.bks"); keyStore.load(keyStoreStream, "password".toCharArray()); KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); keyManagerFactory.init(keyStore, "password".toCharArray()); makeSecure(NanoHTTPD.makeSSLSocketFactory(keyStore, keyManagerFactory), null);