Search code examples
android-studiospongycastle

Add spongycastle as provider to Android Studio


I have tried to add SpongyCastle as a library to my project so I can use DH for key exchange. However, in Android Studio 2.0, I can't add it as a provider. I have followed the instructions of adding as a library and then adding the line

Security.addProvider(new org.spongycastle.jce.provider.BouncyCastleProvider(),1);

But it's telling me that it can't resolve the symbol 'jce'. Is there a path to the provider I can find that will help me use it in Android Studio? I've looked everywhere and everything but come up with nothing in regards to a solution, and I've tried looking through every option typing in the provider line.

Thanks for any help!


Solution

  • You are missing the Spongy Castle JCE provider JAR.

    compile 'com.madgag.spongycastle:prov:1.54.0.0'