curve25519-java icon indicating copy to clipboard operation
curve25519-java copied to clipboard

Signature failures cause NoSuchMethodException on Android Lollipop

Open dkonigsberg opened this issue 7 years ago • 0 comments

Inside curve25519-jni.c, the following code is used to throw an AssertionError when certain signature functions fail: (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/AssertionError"), "Signature failed!");

This works on older versions of Android (e.g. KitKat), however it causes a NoSuchMethodException on newer versions of Android (e.g. Lollipop). This is because AssertionError does not actually have a constructor that takes a String. (Just one that takes an Object, which it internally converts to a string.)

A simple fix would be to pick a different exception that has a String-only constructor. A more complicated fix would be to construct the AssertionError object manually, prior to throwing it.

dkonigsberg avatar Mar 09 '17 19:03 dkonigsberg