JCMathLib icon indicating copy to clipboard operation
JCMathLib copied to clipboard

Can't get add JCMathLib to work with two ECPoints

Open JFBB opened this issue 3 years ago • 1 comments

Hello, I downloaded the latest version of JCMathLib and got the below errors. I then downloaded the latest release (JCMathLib 1.1.0) and got the same result.

I need to be able to add two public keys (BrainpoolP256R1) and read the result. Can you help, please?

        ECConfig ecc = new ECConfig((short)256);
        ECCurve curve = new ECCurve(false, SecP256r1.p, SecP256r1.a, SecP256r1.b, SecP256r1.G, SecP256r1.r);
        ECPoint point1 = new ECPoint(curve, ecc.ech);
        ECPoint point2 = new ECPoint(curve, ecc.ech);
        point1.randomize(); 
        point2.randomize(); 
        point1.add(point2);

This gave a Crypto error.

I also tried

        ECConfig ecc = new ECConfig((short)256);
        ECCurve curve = new ECCurve(
                false,
                Brainpool256R1.getFp(),
                Brainpool256R1.getA(),
                Brainpool256R1.getB(),
                Brainpool256R1.getG(),
                Brainpool256R1.getR()
                );
        ECPoint point1 = new ECPoint(curve, ecc.ech);
        ECPoint point2 = new ECPoint(curve, ecc.ech);
        point1.setW(cryptoBuf, (short)0, hashLen);
        point2.setW(CA, (short)0, (short)CA.length);
        point1.add(point2);

This gave the same error.

JFBB avatar Nov 17 '22 16:11 JFBB

Hi, on which card are you trying to use JCMathLib? Is it one of the cards on which JCMathLib has been tested? I would recommend using the new version of the library, Release 2.0., which extended its support to more cards.

dufkan avatar Jul 03 '23 08:07 dufkan