Closed tintin10q closed 1 year ago
Do you know what is happening here? Is this possible to fix?
ok I changed the OperationSupport to be like this:
package opencrypto.jcmathlib;
/**
* OperationSupport class
*
* @author Antonin Dufka
*/
public class OperationSupport {
private static OperationSupport instance;
public static final short SIMULATOR = 0x0000;
public static final short J2E145G = 0x0001;
public static final short J3H145 = 0x0002;
public static final short J3R180 = 0x0003;
public boolean RSA_MULT_TRICK = false;
public boolean RSA_MOD_EXP = true;
public boolean RSA_PREPEND_ZEROS = true;
public boolean RSA_KEY_REFRESH = true;
public boolean ECDH_XY = true;
public boolean ECDH_X_ONLY = true;
public boolean EC_SW_DOUBLE = false;
private OperationSupport() {}
public static OperationSupport getInstance() {
if (OperationSupport.instance == null)
OperationSupport.instance = new OperationSupport();
return OperationSupport.instance;
}
public void setCard(short card_identifier) {
System.out.print("Card identifier SET CARD:");
System.out.println(card_identifier);
switch (card_identifier) {
case SIMULATOR:
RSA_MULT_TRICK = true;
RSA_MOD_EXP = false;
RSA_PREPEND_ZEROS = true;
RSA_KEY_REFRESH = true;
ECDH_XY = true;
EC_SW_DOUBLE = true;
break;
case J2E145G:
RSA_MULT_TRICK = true;
RSA_MOD_EXP = true;
break;
case J3H145:
RSA_MULT_TRICK = true;
RSA_MOD_EXP = true;
break;
case J3R180:
RSA_MULT_TRICK = true;
RSA_MOD_EXP = true;
break;
default:
break;
}
}
}
Now it does multiplication and it adds point to itself but only if they are the same points. Other points does not work yet.
I think the issue is that the bouncy castle in the simulator is checking if the modulus is even and trowing an error if it is.
Yes, that is likely the case. New versions of jCardSim introduced more restrictions on modulus, and in the default setting, it is not compatible with JCMathLib 1.1.0. If you want to use this new simulator version with JCMathLib, you need to set property com.licel.jcardsim.bouncycastle.rsa.allow_unsafe_mod
to true
. Still, it may require more changes, as I remember we had to also change the computation a bit to get JCMathLib fully working in this simulator. See the new version of JCMathLib.
The property is already set for the simulator used for testing in JCMathLib version 2.0.
The new version of the library has been released, which should fix the issue. If the problem persists, please, reopen this issue.
At first I could not multiplication did not work for me but then I just set everything to true in OperationSupport and then multiplication started to work.
I am getting a non supported error in the simulator for
add
. I am just running the example in the simulator like this:But I get this error:
I uploaded the simulator I am using to github.
jcardsim-3.0.5-20230313.131323-6.jar.zip