I am trying to implement the RSA-Algorithm in an Android Application. I am using the java.math.BigInteger.modPow()
function for the en-/decryption which works fine for my Computer (Windows and Xubuntu) and my Raspberry Pi (also Debian).
When the same Code is executed on my Phone (Android 4.4.4) the following Exception is thrown on the 2nd call to modPow()
:
java.jang.ArithmeticException: error:0306B06B:bignum routines:BN_div:not initialized
at java.math.NativeBN.BN_mod_exp(NativeMethod)
at java.math.BigInt.modExp(BigInt.java:327)
at java.math.BigInteger.modPow(BigInteger.java:997)
at "where I call java.math.BigInteger.modPow()"
I checked the exponent and modulus: both are positive so the Documentation doesn't really help. Reducing the size of the key (exponent and modulus) also did not change anything. Unfortunately I could not find the source to the native function and are out of ideas what might be going on.
Do you have any idea why this exception might be thrown or what the errorcode is supposed to mean?