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

java.io.IOException: Wrong version of key store. #523

Open
GMF018 opened this issue Nov 22, 2018 · 5 comments
Open

java.io.IOException: Wrong version of key store. #523

GMF018 opened this issue Nov 22, 2018 · 5 comments
Labels

Comments

@GMF018
Copy link

GMF018 commented Nov 22, 2018

When I try to set Https for it .

@LordFokas
Copy link
Member

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.

@vitiruiz
Copy link

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());

@GMF018
Copy link
Author

GMF018 commented Dec 7, 2018

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 .

@GMF018
Copy link
Author

GMF018 commented Dec 7, 2018

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?

@ravibpatel
Copy link

It only supports the BKS-V1 Keystore. You can use a tool like KeyStore Explorer to change the type of KeyStore to BKS-V1.

https://stackoverflow.com/a/51763282/1273550

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

No branches or pull requests

4 participants