KeyStore error on java server: BKS not found

Mike Alike picture Mike Alike · Jul 27, 2012 · Viewed 7.7k times · Source

I get an error on this line:

final KeyStore keyStore = KeyStore.getInstance("BKS");

the error i get is:

java.security.KeyStoreException: BKS not found
    at java.security.KeyStore.getInstance(Unknown Source)
    at AppListen.<init>(AppListen.java:84)

i added bcprov-jdk16-146.jar to the "Referenced Libraries" but still no luck.

My overall program allows an android phone to be used as mouse and keyboard for a computer using an SSL socket connection. The android app has the same line with no errors.

What am i doing wrong?


EDIT:

Maybe this is common knowledge for most, but it wasn't for me, so for those like me this is what i did.

The reason i was using BKS was because that's the only format allowed by android, but i didnt know that you only needed it on the android side, you can use another format on the server and then make a copy of the key and convert it to BKS to use on the android, eliminating the need for BouncyCastle.

I used a JKS key for the server and than converted a copy of that key to BKS to use on the android using a program called portecle.

Answer

Sumit Singh picture Sumit Singh · Jul 27, 2012

This error indicates that keytool tries to instantiate a BKS keystore but no Cryptographic Service Provider (CSP) is able to provide such an implementation. BKS keystore type is a type implemented by the BouncyCastle CSP
So you have to install BouncyCastle provider with Java. Installing Providers
And Look into this also.