-1
    X9ECParameters params = SECNamedCurves.getByName("secp256k1");
    ECDomainParameters CURVE = new ECDomainParameters(params.getCurve(), params.getG(), params.getN(), params.getH());
    ECCurve.Fp curve = (ECCurve.Fp) CURVE.getCurve();
    ECFieldElement x1 = new ECFieldElement.Fp(curve.getQ(), x);

How do I get the same ECFieldElement object as above, but with the constraint that I can only use any of the following constructors.

    public F2m(int m, int k1, int k2, int k3, java.math.BigInteger x);

    public F2m(int m, int k, java.math.BigInteger x);

    private F2m(int m, int k1, int k2, int k3, org.spongycastle.math.ec.IntArray x);

I'm no crypto expert. I don't know what all these other parameters are.

user299648
  • 2,769
  • 6
  • 34
  • 43

1 Answers1

1

Fp is a finite field whose elements are numbers from 0 to p-1.

F2m is a finite field whose elements are binary strings of length m bits, which means numbers from 0 to 2m-1.

secp256k1 is a curve over Fp field. It can be represented as org.bouncycastle.math.ec.ECPoint.Fp (or equivalent spongycastle class) whose purpose is to contain the definition of Fp curve.

It can not be represented as org.bouncycastle.math.ec.ECPoint.F2m (or equivalent spongycastle class) whose purpose is to contain the definition of F2m curve.

If you do not know what is Fp, or F2m, or secp256k1 or what do ECPoint.F2m constructor parameters mean you should stop immediately. Hacking your way around cryptography without understanding what are you doing until it seems to work will lead to disaster sooner or later.

Oleg Estekhin
  • 8,063
  • 5
  • 49
  • 52