0
votes
$\begingroup$

I'd like to use a curve that's not included in the Bouncy Castle EC named curves spec, specifically E-521.

According to the BC javadocs, you need a few values in order to do this: q, a, and b for the curve, then G and n for the parameter spec.

import org.bouncycastle.math.ec.ECCurve;
import org.bouncycastle.jce.spec.ECParameterSpec;
...
ECCurve curve = new ECCurve.Fp(
            new BigInteger("883423532389192164791648750360308885314476597252960362792450860609699839"), // q
            new BigInteger("7fffffffffffffffffffffff7fffffffffff8000000000007ffffffffffc", 16), // a
            new BigInteger("6b016c3bdcf18941d0d654921475ca71a9db2fb27d1d37796185c2942c0a", 16)); // b
ECParameterSpec ecSpec = new ECParameterSpec(
            curve,
            curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G
            new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307")); // n
KeyPairGenerator g = KeyPairGenerator.getInstance("ECDSA", "BC");
g.initialize(ecSpec, new SecureRandom());
KeyPair pair = g.generateKeyPair();

I think q is the field.

Would a and b be base points?

What should be used for G and n?

$\endgroup$
1
  • $\begingroup$ BouncyCastle only supports weierstrass for curves. So you'd need to convert the curve and the points from edwards to weierstrass before use. Of course this negates most of the advantage of E521 over curves like P521, the fast and constant time arithmetic in edwards or montgomery form. $\endgroup$ Commented Sep 22, 2014 at 7:54

1 Answer 1

1
vote
$\begingroup$

In order to do this, first convert the Edwards curve to Montgomery form, then to Weierstrass form, per this thread.

But, as the above thread explains, as well as CodesInChaos' comment, this will result in poor performance.

Thanks to CodesInChaos for pointing me in the right direction despite the stupid question.

Also see:

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.