Need explanation of Elliptic Curve Key Pair Generation code

599 Views Asked by At

I am trying to implement an ECC curve basec program and I saw this code on their official page

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");

Now, I need to specify my own parameters. I have a, b and q (value of field) and also a generator point (x,y). Now this code has a single value G, not in (x,y) - how do they get this value? Also how can find the value of n which has been used here in this code?

Precisely I need to know that given values of a, b, q and a (x,y) point, how can the values of G and n have been generated?

0

There are 0 best solutions below