Search code examples
javaandroidbouncycastle

Bouncycastle elliptic curve encryption on Android


I'm trying to decrypt an X509 cert on an android device using Bouncycastle. However, I am consistently getting

java.lang.RuntimeException: algorithm identifier 1.2.840.10045.2.1 in key not recognised.

However, when I run the exact same code on my own computer, it works perfectly fine. Is android overriding some of the bouncycastle libraries with an outdated version?


Solution

  • I don't think Android has full ECC capabilities yet. The bouncycastle android uses has a lot of that taken out. I would take a look at spongycastle, however, which attempts to implement all of bouncycastle's original functionality for Android.

    Here's a link to a bouncy castle topic talking about missing ECC in android.

    Here's a link to SpongyCastle