This thing has been bugging me for couple days now. I've read lots of other questions about this whole issue and still haven't been able to proceed.
I've created a simple test application just to test SSL on Android. The application has only one button and when clicked the application tries to send "Hello World" over SSL encrypted connection to my test server, which then responds with the exact same phrase.
First I created a test key and test certificate for my server using openssl. Then I've been following the instructions showed in Crazy Bob's blog. I got the Bouncy Castle provider directly from Bouncy Castle's site, created a trusted keystore as shown on Crazy Bob's blog and got everything right at that point I believe.
When I tried to run my code, I got the exception "IOException: Wrong version of key store." Then I found this question on StackOverflow. There it was suggested that I should try using older Bouncy Castle Providers rather than the newest bcprov-jdk15on-147.jar. I went on with this in mind and actually ended up trying every bcprovider from jdk13-146 to jdk16-146. Still every time I got the same "IOExcpetion: wrong version of key store." exception.
Then I found yet another question about similar problem on StackOverflow. There someone had managed to get rid of that exception by using 512 bit sized key instead of 1024 sized key. Well I gave it a try and accomplished nothing, but the same exception.
So here I am now, wondering what to do next. I'm pretty much running out of ideas and google search results.
My web code is 1 on 1 copy of crazy bob's code and besides that the application has only the activity class that handles the button only. I'm trying to implement this on API level 7.
Any help would be greatly appreciated. Thanks.
Well I also faced this same situation and to solve it I took help from same blog post(http://nelenkov.blogspot.in/2011/12/using-custom-certificate-trust-store-on.html) referred by R4j. Following are the steps involved :
Finally to create secure HTTPClient you can do something like this:
For detailed reasons of my choices you can refer to this post http://fuking-android.quora.com/Implement-HTTPS-for-android-apps-a-novices-tale.
2 choices:
You can do what you do and create your own key store and I've done that, here is instructions from my code that I stored (because it was so time consuming to get it to work):
To generate PKS:
Create TRUST ALL KeyStore and forget about all this. Basically, you can use any SSL without errors. Just disable it in production if you really care. Here is code I use to get SSL client prepared (assuming you use Apache Http client)
It is similar my question when I try to request to EWS. You can refer to this link and download example source code then modify it like my answer. Hope this helps!
Update:
The following command worked for me (I tried it about 2 months ago):
You can see, I use bcprov-jdk16-145.jar and openssl lib. You can try it.
Another tool to create keystore: http://portecle.sourceforge.net/