How to include the Spongy Castle JAR in Android?

If you are using gradle, then you can just specify your dependencies in build.gradle file like this:

dependencies {
     ....
    compile 'com.madgag.spongycastle:core:1.54.0.0'
    compile 'com.madgag.spongycastle:prov:1.54.0.0'
    compile 'com.madgag.spongycastle:pkix:1.54.0.0'
    compile 'com.madgag.spongycastle:pg:1.54.0.0'

    }

You can find out the latest version of the library here.

Don’t forget to insert it as a security provider in your app.

    static {
    Security.insertProviderAt(new org.spongycastle.jce.provider.BouncyCastleProvider(), 1);
}

Leave a Comment