NoSuchAlgorithmException with KeyStore.getInstance in Android applications… here is a solution to the problem.
NoSuchAlgorithmException with KeyStore.getInstance in Android applications
I
write programs in Android to communicate with the server, and I use SSL protocol when writing this code
KeyStore ks = KeyStore.getInstance( "JKS" );
I get this error
java.security.NoSuchAlgorithmException: KeyStore JKS implementation
not found
How do I solve my problem?
My algorithm is JKS.
Best regards
Solution
Android does not support JKS keystores. However, you can convert a JKS keystore to a BouncyCaSTLe BKS keystore and it will work.
@Edit
You will need bcprov-jdk16-145.jar
keytool -importkeystore -srckeystore mytruststore.jks -destkeystore mytruststore.bks -srcstoretype JKS -deststoretype BKS -srcstorepass changeit -deststorepass changeit - provider org.bouncycastle.jce.provider.BouncyCastleProvider
If your bcprov jar is in another directory, add the -providerpath path.
The code is taken from: http://www.knowledgebit.appspot.com/zahangirbd/TopicView.action;jsessionid=E2BZt_6bp4uFFbMyq42gWg?id=56001