0

I have developed an application that uses bouncy castle provider for generating keystore. Everything was working fine on Gingerbread(2.3.3) until i updated my test device with ICS. Now, its not able to find the bouncy castle provider. I'm getting this exception:

07-11 12:40:51.317 E/AndroidRuntime( 8049): Caused by: java.lang.NoClassDefFoundError: org.bouncycastle.jce.provider.BouncyCastleProvider

I searched about this and figured that in ICS, a trust store has been introduced and i want to know whether bouncy castle can still be used in ICS. I have seen some threads related to bouncy castle provider, but couldn't get the solution. Please help.

Thanks, Deepak

TZHX
  • 5,291
  • 15
  • 47
  • 56
Deepak
  • 190
  • 8
  • Nothing in org.bouncycastle is officially part of the Android API. Therefore any use of it is a bad idea. If you want to explicitly use bouncycastle functionality then install the Spongycastle libraries. – President James K. Polk Jul 14 '12 at 17:42

3 Answers3

0

Try a clean of all your projects.

It should work then.

Brad
  • 9,113
  • 10
  • 44
  • 68
  • Hi Geoff, Thanks for the reply. But cleaning of the projects didn't work. When i searched abouth this i got to know that Bouncy castle was removed and a new trust store was implemented in ICS. But i wanted to know how can we use bouncy castle in ICS. So, that my application would be compatible with Gingerbread as well as ICS. – Deepak Jul 13 '12 at 04:58
0

You must include BouncyCastle in your own APK. You can't rely on the platform's version of BouncyCastle to be there, because it might change between releases.

To make things easy on yourself, just use the SpongyCastle package made specifically for Android applications. Also see this question about SpongyCastle.

Community
  • 1
  • 1
kroot
  • 1,962
  • 1
  • 12
  • 10
0

Not only do you need to worry about the store type being BKS rather than JKS, but you need to worry about different versions of the BKS format. I am not an expert, so don't take the following as the last word, but based on a bit of experimentation and some reading, Android, at least in ICS (api 15) uses version 1.46 of the Bouncy Castle provider. Meanwhile the latest release of BounceCastle is 1.47, which is not backwards compatible

Using the correct format (BKS) but the wrong version may give you the error:

Keystore format problem: Wrong version of key store.

from the Android framework, or from the keytool program:

java.io.IOException: Wrong version of key store.
Community
  • 1
  • 1
Adam Mackler
  • 1,980
  • 1
  • 18
  • 32