1

I'm developing an android honeycomb app that requires the use of the BouncyCastle library (bcprov-jdk15-143.jar). I've included this jar in my libs folder and added it to my build path. Unfortunately, it's relatively large (1.6 Megs) and it takes several minutes for Eclipse to package it up into Dalvik byte code. This is making it very slow to develop as each time I want to test my changes, I need to wait for the packaging to finish.

The requirement for BouncyCastle comes from using google's google-tv-pairing-protocol. http://code.google.com/p/google-tv-pairing-protocol/

Does anyone have any good ideas for making my life easier?

Is there a smaller version of BouncyCastle? Can I somehow extract only what I need and repackage? Is there a lightweight alternative?

Jimtronic
  • 1,179
  • 1
  • 9
  • 22

1 Answers1

1

I need to wait for the packaging to finish

More importantly, it may not work. Bouncy Castle is part of Android's implementation of javax.crypto -- people have reported all sorts of trouble trying to add BC as a JAR to their projects.

If you can stick with the javax.crypto interface, I would do that and avoid BC entirely. If not, try Spongy Castle, which is a repackaging of BC into a separate Java package to avoid VM issues. If you wanted, you could perhaps find ways to get rid of stuff you didn't need from your copy of Spongy Castle -- it is substantially larger than the BC JAR you cite, for some reason.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Thanks for the info. I did try SpongyCastle and it worked with little effort, but as you say, it's about twice as big as BouncyCastle. – Jimtronic Oct 17 '11 at 19:59
  • @Jimtronic: Yeah, I have no idea why it wound up that large. A BC-specific list might be able to give you tips for trimming down the size. Beyond that, I'd eyeball BC packages that seem possibly irrelevant, remove them, and see if everything still builds and runs. Not especially scientific, I'll grant you... :-) You might also file an issue on the Spongy Castle site regarding JAR size and any suggestions that developer might have on trimming things down. – CommonsWare Oct 17 '11 at 20:04
  • 1
    Haven't actually used it, but a after a quick look through the code, it seems it only uses raw BC APIs to generate a self-signed certificate. Check their documentation for details, but 1) you may not need a certificate for the client at all, and 2) if you pre-generate it, you can delete/comment out this part of the code. – Nikolay Elenkov Oct 18 '11 at 02:32
  • 2
    @CommonsWare there's now a 'sc-light-jdk15on' artifact for Spongy Castle that includes just the Bouncy Castle lightweight API; it's only 1.4 MB in size. https://github.com/rtyley/spongycastle/wiki/jars has a list of the available SC artifacts. – Roberto Tyley May 18 '12 at 11:49