aboutsummaryrefslogtreecommitdiff
path: root/standalone/src/main/java
diff options
context:
space:
mode:
authorJ08nY2024-08-02 15:25:41 +0200
committerJ08nY2024-08-02 15:25:41 +0200
commit40c50615d1476b8347e6f6575c4f49911e3a55ff (patch)
treeab31682e257ba7d05822e2499ab1f0e5217784ed /standalone/src/main/java
parent6f0e99cd8b61a4d3ddecc78c0431b0277c1781a2 (diff)
downloadECTester-40c50615d1476b8347e6f6575c4f49911e3a55ff.tar.gz
ECTester-40c50615d1476b8347e6f6575c4f49911e3a55ff.tar.zst
ECTester-40c50615d1476b8347e6f6575c4f49911e3a55ff.zip
Move conversion to custom curve to params class.
Diffstat (limited to 'standalone/src/main/java')
-rw-r--r--standalone/src/main/java/cz/crcs/ectester/standalone/test/suites/StandaloneWrongSuite.java28
1 files changed, 1 insertions, 27 deletions
diff --git a/standalone/src/main/java/cz/crcs/ectester/standalone/test/suites/StandaloneWrongSuite.java b/standalone/src/main/java/cz/crcs/ectester/standalone/test/suites/StandaloneWrongSuite.java
index 8b3133a..24a942b 100644
--- a/standalone/src/main/java/cz/crcs/ectester/standalone/test/suites/StandaloneWrongSuite.java
+++ b/standalone/src/main/java/cz/crcs/ectester/standalone/test/suites/StandaloneWrongSuite.java
@@ -261,35 +261,9 @@ public class StandaloneWrongSuite extends StandaloneTestSuite {
return CompoundTest.all(Result.ExpectedValue.SUCCESS, desc, generate, ecdh);
}
- //constructs EllipticCurve from EC_Curve even if the parameters of the curve are wrong
- private EllipticCurve toCustomCurve(EC_Curve curve) {
- ECField field;
- if (curve.getField() == javacard.security.KeyPair.ALG_EC_FP) {
- field = new CustomECFieldFp(new BigInteger(1, curve.getData(0)));
- } else {
- byte[][] fieldData = curve.getParam(EC_Consts.PARAMETER_F2M);
- int m = ByteUtil.getShort(fieldData[0], 0);
- int e1 = ByteUtil.getShort(fieldData[1], 0);
- int e2 = ByteUtil.getShort(fieldData[2], 0);
- int e3 = ByteUtil.getShort(fieldData[3], 0);
- int[] powers;
- if (e2 == 0 && e3 == 0) {
- powers = new int[]{e1};
- } else {
- powers = new int[]{e1, e2, e3};
- }
- field = new CustomECFieldF2m(m, powers);
- }
-
- BigInteger a = new BigInteger(1, curve.getParam(EC_Consts.PARAMETER_A)[0]);
- BigInteger b = new BigInteger(1, curve.getParam(EC_Consts.PARAMETER_B)[0]);
-
- return new CustomEllipticCurve(field, a, b);
- }
-
//constructs ECParameterSpec from EC_Curve even if the parameters of the curve are wrong
private ECParameterSpec toCustomSpec(EC_Curve curve) {
- EllipticCurve customCurve = toCustomCurve(curve);
+ EllipticCurve customCurve = curve.toCustomCurve();
byte[][] G = curve.getParam(EC_Consts.PARAMETER_G);
BigInteger gx = new BigInteger(1, G[0]);