Skip to content

Can't get add JCMathLib to work with two ECPoints #25

Description

@JFBB

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions