java.security.spec.ECFieldF2m Java Examples

The following examples show how to use java.security.spec.ECFieldF2m. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EC5Util.java    From ripple-lib-java with ISC License 6 votes vote down vote up
public static ECCurve convertCurve(
    EllipticCurve ec)
{
    ECField field = ec.getField();
    BigInteger a = ec.getA();
    BigInteger b = ec.getB();

    if (field instanceof ECFieldFp)
    {
        ECCurve.Fp curve = new ECCurve.Fp(((ECFieldFp)field).getP(), a, b);

        if (customCurves.containsKey(curve))
        {
            return (ECCurve)customCurves.get(curve);
        }

        return curve;
    }
    else
    {
        ECFieldF2m fieldF2m = (ECFieldF2m)field;
        int m = fieldF2m.getM();
        int ks[] = ECUtil.convertMidTerms(fieldF2m.getMidTermsOfReductionPolynomial());
        return new ECCurve.F2m(m, ks[0], ks[1], ks[2], a, b); 
    }
}
 
Example #2
Source File: ECFieldF2mTest.java    From j2objc with Apache License 2.0 6 votes vote down vote up
/**
 * Tests for constructor <code>ECFieldF2m(int m, BigInteger rp)</code><br>
 *
 * Assertion: constructs new <code>ECFieldF2m</code> object
 * using valid parameters m and rp.
 *
 * Assertion: constructs new <code>ECFieldF2m</code> object
 * using valid parameters m and rp.
 *
 * Assertion: IllegalArgumentException if m is not positive.
 *
 * Assertion: NullPointerException if rp is null.
 *
 * Assertion: IllegalArgumentException if rp is invalid.
 */
public final void testECFieldF2mintBigInteger() {
    for(int i=0; i<constructorTestParameters.length; i++) {
        ECFieldF2mDomainParams tp = constructorTestParameters[i];
        try {
            // perform test
            new ECFieldF2m(tp.m, tp.rp);

            if (tp.x != null) {
                // exception has been expected
                fail(getName() + ", set " + i +
                        " FAILED: expected exception has not been thrown");
            }
        } catch (Exception e){
            if (tp.x == null || !e.getClass().isInstance(tp.x)) {
                // exception: failure
                // if it has not been expected
                // or wrong one has been thrown
                fail(getName() + ", set " + i +
                        " FAILED: unexpected " + e);
            }
        }
    }
}
 
Example #3
Source File: ECFieldF2mTest.java    From j2objc with Apache License 2.0 6 votes vote down vote up
/**
 * Tests for constructor <code>ECFieldF2m(int m, int[] ks)</code><br>
 *
 * Assertion: constructs new <code>ECFieldF2m</code> object
 * using valid parameters m and rp. ks represents trinomial basis.
 *
 * Assertion: constructs new <code>ECFieldF2m</code> object
 * using valid parameters m and ks. ks represents pentanomial basis.
 *
 * Assertion: IllegalArgumentException if m is not positive.
 *
 * Assertion: NullPointerException if ks is null.
 *
 * Assertion: IllegalArgumentException if ks is invalid.
 */
public final void testECFieldF2mintintArray() {
    for(int i=0; i<constructorTestParameters.length; i++) {
        ECFieldF2mDomainParams tp = constructorTestParameters[i];
        try {
            // perform test
            ECFieldF2m test = new ECFieldF2m(tp.m, tp.ks);

            if (tp.x != null) {
                // exception has been expected
                fail(getName() + ", set " + i +
                        " FAILED: expected exception has not been thrown");
            }
        } catch (Exception e){
            if (tp.x == null || !e.getClass().isInstance(tp.x)) {
                // exception: failure
                // if it has not been expected
                // or wrong one has been thrown
                fail(getName() + ", set " + i +
                        " FAILED: unexpected " + e);
            }
        }
    }
}
 
Example #4
Source File: ECFieldF2mTest.java    From j2objc with Apache License 2.0 6 votes vote down vote up
/**
 * Tests for constructor <code>ECFieldF2m(int)</code><br>
 *
 * Assertion: constructs new <code>ECFieldF2m</code> object
 * using valid parameter m.
 *
 * Assertion: IllegalArgumentException if m is not positive.
 */
public final void testECFieldF2mint() {
    for(int i=0; i<intCtorTestParameters.length; i++) {
        ECFieldF2mDomainParams tp = intCtorTestParameters[i];
        try {
            // perform test
            new ECFieldF2m(tp.m);

            if (tp.x != null) {
                // exception has been expected
                fail(getName() + ", set " + i +
                        " FAILED: expected exception has not been thrown");
            }
        } catch (Exception e){
            if (tp.x == null || !e.getClass().isInstance(tp.x)) {
                // exception: failure
                // if it has not been expected
                // or wrong one has been thrown
                fail(getName() + ", set " + i +
                        " FAILED: unexpected " + e);
            }
        }
    }
}
 
Example #5
Source File: EC5Util.java    From RipplePower with Apache License 2.0 6 votes vote down vote up
public static ECCurve convertCurve(
    EllipticCurve ec)
{
    ECField field = ec.getField();
    BigInteger a = ec.getA();
    BigInteger b = ec.getB();

    if (field instanceof ECFieldFp)
    {
        ECCurve.Fp curve = new ECCurve.Fp(((ECFieldFp)field).getP(), a, b);

        if (customCurves.containsKey(curve))
        {
            return (ECCurve)customCurves.get(curve);
        }

        return curve;
    }
    else
    {
        ECFieldF2m fieldF2m = (ECFieldF2m)field;
        int m = fieldF2m.getM();
        int ks[] = ECUtil.convertMidTerms(fieldF2m.getMidTermsOfReductionPolynomial());
        return new ECCurve.F2m(m, ks[0], ks[1], ks[2], a, b); 
    }
}
 
Example #6
Source File: ECPointUtil.java    From ripple-lib-java with ISC License 5 votes vote down vote up
/**
 * Decode a point on this curve which has been encoded using point
 * compression (X9.62 s 4.2.1 and 4.2.2) or regular encoding.
 * 
 * @param curve
 *            The elliptic curve.
 * @param encoded
 *            The encoded point.
 * @return the decoded point.
 */
public static ECPoint decodePoint(
   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.ripple.bouncycastle.math.ec.ECPoint p = c.decodePoint(encoded);

    return new ECPoint(p.getAffineXCoord().toBigInteger(), p.getAffineYCoord().toBigInteger());
}
 
Example #7
Source File: EC5Util.java    From RipplePower with Apache License 2.0 5 votes vote down vote up
public static EllipticCurve convertCurve(
    ECCurve curve, 
    byte[]  seed)
{
    // TODO: the Sun EC implementation doesn't currently handle the seed properly
    // so at the moment it's set to null. Should probably look at making this configurable
    if (ECAlgorithms.isFpCurve(curve))
    {
        return new EllipticCurve(new ECFieldFp(curve.getField().getCharacteristic()), curve.getA().toBigInteger(), curve.getB().toBigInteger(), null);
    }
    else
    {
        ECCurve.F2m curveF2m = (ECCurve.F2m)curve;
        int ks[];
        
        if (curveF2m.isTrinomial())
        {
            ks = new int[] { curveF2m.getK1() };
            
            return new EllipticCurve(new ECFieldF2m(curveF2m.getM(), ks), curve.getA().toBigInteger(), curve.getB().toBigInteger(), null);
        }
        else
        {
            ks = new int[] { curveF2m.getK3(), curveF2m.getK2(), curveF2m.getK1() };
            
            return new EllipticCurve(new ECFieldF2m(curveF2m.getM(), ks), curve.getA().toBigInteger(), curve.getB().toBigInteger(), null);
        } 
    }
}
 
Example #8
Source File: ECNamedCurveSpec.java    From RipplePower with Apache License 2.0 5 votes vote down vote up
private static EllipticCurve convertCurve(
    ECCurve  curve,
    byte[]   seed)
{
    if (ECAlgorithms.isFpCurve(curve))
    {
        return new EllipticCurve(new ECFieldFp(curve.getField().getCharacteristic()), curve.getA().toBigInteger(), curve.getB().toBigInteger(), seed);
    }
    else
    {
        ECCurve.F2m curveF2m = (ECCurve.F2m)curve;
        int ks[];
        
        if (curveF2m.isTrinomial())
        {
            ks = new int[] { curveF2m.getK1() };
            
            return new EllipticCurve(new ECFieldF2m(curveF2m.getM(), ks), curve.getA().toBigInteger(), curve.getB().toBigInteger(), seed);
        }
        else
        {
            ks = new int[] { curveF2m.getK3(), curveF2m.getK2(), curveF2m.getK1() };

            return new EllipticCurve(new ECFieldF2m(curveF2m.getM(), ks), curve.getA().toBigInteger(), curve.getB().toBigInteger(), seed);
        } 
    }

}
 
Example #9
Source File: ECPointUtil.java    From RipplePower with Apache License 2.0 5 votes vote down vote up
/**
 * Decode a point on this curve which has been encoded using point
 * compression (X9.62 s 4.2.1 and 4.2.2) or regular encoding.
 * 
 * @param curve
 *            The elliptic curve.
 * @param encoded
 *            The encoded point.
 * @return the decoded point.
 */
public static ECPoint decodePoint(
   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.ripple.bouncycastle.math.ec.ECPoint p = c.decodePoint(encoded);

    return new ECPoint(p.getAffineXCoord().toBigInteger(), p.getAffineYCoord().toBigInteger());
}
 
Example #10
Source File: ECNamedCurveSpec.java    From ripple-lib-java with ISC License 5 votes vote down vote up
private static EllipticCurve convertCurve(
    ECCurve  curve,
    byte[]   seed)
{
    if (ECAlgorithms.isFpCurve(curve))
    {
        return new EllipticCurve(new ECFieldFp(curve.getField().getCharacteristic()), curve.getA().toBigInteger(), curve.getB().toBigInteger(), seed);
    }
    else
    {
        ECCurve.F2m curveF2m = (ECCurve.F2m)curve;
        int ks[];
        
        if (curveF2m.isTrinomial())
        {
            ks = new int[] { curveF2m.getK1() };
            
            return new EllipticCurve(new ECFieldF2m(curveF2m.getM(), ks), curve.getA().toBigInteger(), curve.getB().toBigInteger(), seed);
        }
        else
        {
            ks = new int[] { curveF2m.getK3(), curveF2m.getK2(), curveF2m.getK1() };

            return new EllipticCurve(new ECFieldF2m(curveF2m.getM(), ks), curve.getA().toBigInteger(), curve.getB().toBigInteger(), seed);
        } 
    }

}
 
Example #11
Source File: EC5Util.java    From ripple-lib-java with ISC License 5 votes vote down vote up
public static EllipticCurve convertCurve(
    ECCurve curve, 
    byte[]  seed)
{
    // TODO: the Sun EC implementation doesn't currently handle the seed properly
    // so at the moment it's set to null. Should probably look at making this configurable
    if (ECAlgorithms.isFpCurve(curve))
    {
        return new EllipticCurve(new ECFieldFp(curve.getField().getCharacteristic()), curve.getA().toBigInteger(), curve.getB().toBigInteger(), null);
    }
    else
    {
        ECCurve.F2m curveF2m = (ECCurve.F2m)curve;
        int ks[];
        
        if (curveF2m.isTrinomial())
        {
            ks = new int[] { curveF2m.getK1() };
            
            return new EllipticCurve(new ECFieldF2m(curveF2m.getM(), ks), curve.getA().toBigInteger(), curve.getB().toBigInteger(), null);
        }
        else
        {
            ks = new int[] { curveF2m.getK3(), curveF2m.getK2(), curveF2m.getK1() };
            
            return new EllipticCurve(new ECFieldF2m(curveF2m.getM(), ks), curve.getA().toBigInteger(), curve.getB().toBigInteger(), null);
        } 
    }
}
 
Example #12
Source File: ECFieldF2mTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Test #5 for <code>equals()</code> method.<br>
 *
 * Assertion: objects equal if their m, and rp are mutually equal.
 */
public final void testEqualsObject05() {
    ECFieldF2m f1 = new ECFieldF2m(2000);
    ECFieldF2m f2 = new ECFieldF2m(2000, BigInteger.valueOf(0L).
            setBit(0).setBit(1).setBit(2).
            setBit(981).setBit(2000));
    assertFalse(f1.equals(f2) || f2.equals(f1));
}
 
Example #13
Source File: ECParameterSpecTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
protected void setUp() throws Exception {
    super.setUp();
    curve = new EllipticCurve(new ECFieldF2m(2), BigInteger.valueOf(1),
            BigInteger.valueOf(1));
    ecpoint = new ECPoint(BigInteger.valueOf(1), BigInteger.valueOf(1));
    ecps = new ECParameterSpec(curve, ecpoint, BigInteger.valueOf(1), 1);
}
 
Example #14
Source File: ECFieldF2mTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Tests that object state is preserved against
 * modifications through array reference returned by
 * <code>getMidTermsOfReductionPolynomial()</code> method.
 */
public final void testIsStatePreserved02() {
    // reference array
    int[] a = new int[] {981,2,1};
    // reference array copy
    int[] aCopy = a.clone();
    // create obj using copy
    ECFieldF2m f = new ECFieldF2m(2000, aCopy);
    // get array reference and modify returned array
    f.getMidTermsOfReductionPolynomial()[0] = 1532;
    // compare reference with returned for the second time array
    assertTrue(Arrays.equals(a, f.getMidTermsOfReductionPolynomial()));
}
 
Example #15
Source File: ECFieldF2mTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Tests that object state is preserved against modifications
 * through array reference passed to the constructor.
 */
public final void testIsStatePreserved01() {
    // reference array
    int[] a = new int[] {367};
    // reference array copy
    int[] aCopy = a.clone();
    // create obj using copy
    ECFieldF2m f = new ECFieldF2m(1999, aCopy);
    // modify copy
    aCopy[0] = 5;
    // compare reference with returned array
    assertTrue(Arrays.equals(a, f.getMidTermsOfReductionPolynomial()));
}
 
Example #16
Source File: ECFieldF2mTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Test #1 for <code>getMidTermsOfReductionPolynomial()</code> method.<br>
 *
 * Assertion: returns mid terms of reduction polynomial
 */
public final void testGetMidTermsOfReductionPolynomial01() {
    int[] a = new int[] {981,2,1};
    int[] b = new ECFieldF2m(2000,
            BigInteger.valueOf(0L).setBit(0).setBit(1).
            setBit(2).setBit(981).setBit(2000)).
            getMidTermsOfReductionPolynomial();
    assertTrue(Arrays.equals(a, b));
}
 
Example #17
Source File: EcFieldDef.java    From swim with Apache License 2.0 5 votes vote down vote up
public static EcFieldDef from(ECField field) {
  if (field instanceof ECFieldFp) {
    return EcPrimeFieldDef.from((ECFieldFp) field);
  } else if (field instanceof ECFieldF2m) {
    return EcCharacteristic2FieldDef.from((ECFieldF2m) field);
  } else {
    throw new IllegalArgumentException(field.toString());
  }
}
 
Example #18
Source File: ECFieldF2mTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Test #4 for <code>equals()</code> method.<br>
 *
 * Assertion: pentanomial basis - objects equal if their m, and rp
 * are mutually equal.
 */
public final void testEqualsObject04() {
    ECFieldF2m f1 = new ECFieldF2m(2000, new int[] {981, 2, 1});
    ECFieldF2m f2 = new ECFieldF2m(2000, BigInteger.valueOf(0L).
            setBit(0).setBit(1).setBit(2).
            setBit(981).setBit(2000));
    assertTrue(f1.equals(f2) && f2.equals(f1));
}
 
Example #19
Source File: EcCharacteristic2FieldDef.java    From swim with Apache License 2.0 5 votes vote down vote up
@Override
public ECFieldF2m toECField() {
  if (this.basis != null) {
    return new ECFieldF2m(this.size, this.basis);
  } else {
    return new ECFieldF2m(this.size);
  }
}
 
Example #20
Source File: ECFieldF2mTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Test #5 for <code>hashCode()</code> method.<br>
 *
 * Assertion: must return the same value if invoked
 * on equal (according to the <code>equals(Object)</code> method) objects.
 */
public final void testHashCode05() {
    assertTrue(new ECFieldF2m(2000, new int[] {981, 2, 1}).hashCode() ==
               new ECFieldF2m(2000, BigInteger.valueOf(0L).
                                    setBit(0).setBit(1).setBit(2).
                                    setBit(981).setBit(2000)).hashCode());
}
 
Example #21
Source File: EllipticCurveTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Test #5 for <code>EllipticCurve(ECField, BigInteger, BigInteger, byte[])</code>
 * constructor<br>
 * Assertion: array <code>seed</code> is copied to prevent subsequent modification<br>
 * Test preconditions: pass <code>seed</code> to the ctor then modify it<br>
 * Expected: getSeed() must return unmodified array
 */
public final void testEllipticCurveECFieldBigIntegerBigIntegerbyteArray05() {
    ECFieldF2m f = new ECFieldF2m(5);
    BigInteger a = BigInteger.valueOf(0L);
    BigInteger b = BigInteger.valueOf(19L);
    byte[] seed = new byte[24];
    byte[] seedCopy = seed.clone();
    EllipticCurve c = new EllipticCurve(f, a, b, seedCopy);
    // modify array passed
    seedCopy[0] = (byte) 1;
    // check that above modification did not changed
    // internal state of test object
    assertTrue(Arrays.equals(seed, c.getSeed()));
}
 
Example #22
Source File: ECPublicKeySpecTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
protected void setUp() throws Exception {
    super.setUp();
    ECPoint ecpoint = new ECPoint(BigInteger.valueOf(1), BigInteger
            .valueOf(1));
    EllipticCurve curve = new EllipticCurve(new ECFieldF2m(2), BigInteger
            .valueOf(1), BigInteger.valueOf(1));

    w = new ECPoint(BigInteger.valueOf(1), BigInteger.valueOf(1));
    params = new ECParameterSpec(curve, ecpoint, BigInteger.valueOf(1), 1);
    ecpks = new ECPublicKeySpec(w, params);
}
 
Example #23
Source File: ECPrivateKeySpecTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
protected void setUp() throws Exception {
    super.setUp();

    ECPoint ecpoint = new ECPoint(BigInteger.valueOf(1), BigInteger
            .valueOf(1));
    EllipticCurve curve = new EllipticCurve(new ECFieldF2m(2), BigInteger
            .valueOf(1), BigInteger.valueOf(1));

    s = BigInteger.valueOf(1);
    ecparams = new ECParameterSpec(curve, ecpoint, BigInteger.valueOf(1), 1);
    ecpks = new ECPrivateKeySpec(s, ecparams);
}
 
Example #24
Source File: ECFieldF2mTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Test #1 for <code>hashCode()</code> method.<br>
 *
 * Assertion: must return the same value if invoked
 * repeatedly on the same object.
 */
public final void testHashCode01() {
    ECFieldF2m f = new ECFieldF2m(2000);
    int hc = f.hashCode();
    assertTrue(hc == f.hashCode() &&
               hc == f.hashCode() &&
               hc == f.hashCode() &&
               hc == f.hashCode() &&
               hc == f.hashCode() &&
               hc == f.hashCode() &&
               hc == f.hashCode() &&
               hc == f.hashCode());
}
 
Example #25
Source File: ECFieldF2mTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Test #2 for <code>hashCode()</code> method.<br>
 *
 * Assertion: must return the same value if invoked
 * repeatedly on the same object.
 */
public final void testHashCode02() {
    ECFieldF2m f = new ECFieldF2m(2000, new int[] {981, 2, 1});
    int hc = f.hashCode();
    assertTrue(hc == f.hashCode() &&
               hc == f.hashCode() &&
               hc == f.hashCode() &&
               hc == f.hashCode() &&
               hc == f.hashCode() &&
               hc == f.hashCode() &&
               hc == f.hashCode() &&
               hc == f.hashCode());
}
 
Example #26
Source File: EcCharacteristic2FieldDef.java    From swim with Apache License 2.0 4 votes vote down vote up
public static EcCharacteristic2FieldDef from(ECFieldF2m field) {
  return new EcCharacteristic2FieldDef(field.getM(), field.getReductionPolynomial());
}
 
Example #27
Source File: ECFieldF2mTest.java    From j2objc with Apache License 2.0 4 votes vote down vote up
/**
 * Test #3 for <code>getMidTermsOfReductionPolynomial()</code> method.<br>
 *
 * Assertion: returns mid terms of reduction polynomial
 */
public final void testGetMidTermsOfReductionPolynomial03() {
    int[] a = new int[] {367};
    int[] b = new ECFieldF2m(1999, a).getMidTermsOfReductionPolynomial();
    assertTrue(Arrays.equals(a, b));
}
 
Example #28
Source File: ECFieldF2mTest.java    From j2objc with Apache License 2.0 4 votes vote down vote up
/**
 * Test #1 for <code>getReductionPolynomial()</code> method.<br>
 *
 * Assertion: returns reduction polynomial
 */
public final void testGetReductionPolynomial01() {
    BigInteger rp = BigInteger.valueOf(0L).setBit(0).setBit(1).setBit(2).
    setBit(981).setBit(2000);
    assertTrue(new ECFieldF2m(2000, rp).getReductionPolynomial().equals(rp));
}
 
Example #29
Source File: EllipticCurveTest.java    From j2objc with Apache License 2.0 3 votes vote down vote up
/**
 * Test for <code>getA()</code> method<br>
 * Assertion: returns coefficient <code>a</code><br>
 * Test preconditions: <code>ECFieldF2m</code> instance
 * created using valid parameters<br>
 * Expected: must return coefficient <code>a</code> which is equal
 * to the one passed to the constructor; (both must refer
 * the same object)
 */
public final void testGetA() {
    ECFieldF2m f = new ECFieldF2m(5);
    BigInteger a = BigInteger.valueOf(5L);
    BigInteger b = BigInteger.valueOf(19L);
    EllipticCurve c = new EllipticCurve(f, a, b);
    assertEquals(a, c.getA());
    assertSame(a, c.getA());
}
 
Example #30
Source File: EllipticCurveTest.java    From j2objc with Apache License 2.0 3 votes vote down vote up
/**
 * Test for <code>getB()</code> method<br>
 * Assertion: returns coefficient <code>b</code><br>
 * Test preconditions: <code>ECFieldF2m</code> instance
 * created using valid parameters<br>
 * Expected: must return coefficient <code>b</code> which is equal
 * to the one passed to the constructor; (both must refer
 * the same object)
 */
public final void testGetB() {
    ECFieldF2m f = new ECFieldF2m(5);
    BigInteger a = BigInteger.valueOf(5L);
    BigInteger b = BigInteger.valueOf(19L);
    EllipticCurve c = new EllipticCurve(f, a, b);
    assertEquals(b, c.getB());
    assertSame(b, c.getB());
}