Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

https connection #572

Open
Rezasahebi76 opened this issue Feb 26, 2020 · 1 comment
Open

https connection #572

Rezasahebi76 opened this issue Feb 26, 2020 · 1 comment

Comments

@Rezasahebi76
Copy link

Hi
I try to create https web sever in android app.
I found below code for makeSecure connection but it doesn't work.
val keystore =KeyStore.getInstance(KeyStore.getDefaultType()) val keystoreStream: InputStream = assets.open("keySSS.jks") if (keystoreStream == null) { throw IOException("Unable to load keystore from classpath: " + "keystore.bks") } keystore.load(keystoreStream, "password".toCharArray()) val keyManagerFactory:KeyManagerFactory =KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()) keyManagerFactory.init(keystore, "password".toCharArray()) val server = AndroidWebServer(this) server.makeSecure(NanoHTTPD.makeSSLSocketFactory(keystore, keyManagerFactory), null) server.start(6000)
I generate sign key by below command:
keytool -genkey -keyalg RSA -alias selfsigned -keystore keySSS.jks -storepass password -validity 9999 -keysize 2048 -ext SAN=DNS:localhost,IP:127.0.0.1 -validity 9999
And convert it to bks format with KeyStore Explorer Sofware.
But when i open the IP in browser, browser show below warning:
Your connection to this site is not secure
can anyone say me what's wrong?

@MarcWoodyard
Copy link

The reason you are seeing that error message is because you are using a self-signed certificate. If you want that error message to go away, you need to use a certificate from a certificate authority like Lets Encrypt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants