use of java.security.spec.ECFieldF2m in project j2objc by google.
the class ECParameterSpecTest method setUp.
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);
}
use of java.security.spec.ECFieldF2m in project XobotOS by xamarin.
the class EC5Util method convertCurve.
public static EllipticCurve convertCurve(ECCurve curve, byte[] seed) {
// so at the moment it's set to null. Should probably look at making this configurable
if (curve instanceof ECCurve.Fp) {
return new EllipticCurve(new ECFieldFp(((ECCurve.Fp) curve).getQ()), 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);
}
}
}
use of java.security.spec.ECFieldF2m in project XobotOS by xamarin.
the class EC5Util method convertCurve.
public static ECCurve convertCurve(EllipticCurve ec) {
ECField field = ec.getField();
BigInteger a = ec.getA();
BigInteger b = ec.getB();
if (field instanceof ECFieldFp) {
return new ECCurve.Fp(((ECFieldFp) field).getP(), a, b);
} 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);
}
}
use of java.security.spec.ECFieldF2m in project robovm by robovm.
the class EC5Util method convertCurve.
public static ECCurve convertCurve(EllipticCurve ec) {
ECField field = ec.getField();
BigInteger a = ec.getA();
BigInteger b = ec.getB();
if (field instanceof ECFieldFp) {
return new ECCurve.Fp(((ECFieldFp) field).getP(), a, b);
} 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);
}
}
use of java.security.spec.ECFieldF2m in project robovm by robovm.
the class EC5Util method convertCurve.
public static EllipticCurve convertCurve(ECCurve curve, byte[] seed) {
// so at the moment it's set to null. Should probably look at making this configurable
if (curve instanceof ECCurve.Fp) {
return new EllipticCurve(new ECFieldFp(((ECCurve.Fp) curve).getQ()), 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);
}
}
}
Aggregations