Search code examples
androidsecurityandroid-4.0-ice-cream-sandwichbouncycastle

Running apps using bouncy castle on ICS


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


Solution

  • 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.