Open GMF018 opened 5 years ago
You need to be more specific. If you want help, you must provide as much detail on what you're doing and what's happening if you want someone to help you figure out what is the problem and why.
I am also facing this issue.
I have crated a self signed certificate with keytool:
keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048 -ext SAN=DNS:localhost,IP:127.0.0.1 -validity 9999
And when I try the following code, it thorws an IOException: Wrong version of key store.
KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
InputStream keystoreStream = MainActivity.getContext().getAssets().open("keystore.jks");
keystore.load(keystoreStream, "password".toCharArray());
Files generated from documents to support https, and log error Wrong version of key store.
InputStream keystoreStream = mContext.getAssets().open("test");
KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
keystore.load(keystoreStream, "123456".toCharArray());
KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
keyManagerFactory.init(keystore, "123456".toCharArray());
localserver.setServerSocketFactory(new NanoHTTPD.SecureServerSocketFactory(
NanoHTTPD.makeSSLSocketFactory(keystore, keyManagerFactory), null));
keystoreStream.close();
localserver.start();
this is my code .
You need to be more specific. If you want help, you must provide as much detail on what you're doing and what's happening if you want someone to help you figure out what is the problem and why.
I am also facing this issue.
I have crated a self signed certificate with keytool:
keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048 -ext SAN=DNS:localhost,IP:127.0.0.1 -validity 9999
And when I try the following code, it thorws an IOException: Wrong version of key store.
KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); InputStream keystoreStream = MainActivity.getContext().getAssets().open("keystore.jks"); keystore.load(keystoreStream, "password".toCharArray());
Have you solve this problem?
It only supports the BKS-V1 Keystore. You can use a tool like KeyStore Explorer to change the type of KeyStore to BKS-V1.
When I try to set Https for it .