Code example for EllipticCurve

Methods: getAgetBgetField

0
       EllipticCurve curve, 
       byte[] encoded)
    { 
        ECCurve c = null;
         
        if (curve.getField() instanceof ECFieldFp)
        { 
            c = new ECCurve.Fp(
                    ((ECFieldFp)curve.getField()).getP(), curve.getA(), curve.getB());
        } 
        else 
        { 
            int k[] = ((ECFieldF2m)curve.getField()).getMidTermsOfReductionPolynomial();
             
            if (k.length == 3)
            { 
                c = new ECCurve.F2m(
                        ((ECFieldF2m)curve.getField()).getM(), k[2], k[1], k[0], curve.getA(), curve.getB());
            } 
            else 
            { 
                c = new ECCurve.F2m(
                        ((ECFieldF2m)curve.getField()).getM(), k[0], curve.getA(), curve.getB());
            } 
        } 
         
        org.bouncycastle.math.ec.ECPoint p = c.decodePoint(encoded);