aboutsummaryrefslogtreecommitdiff
path: root/src/cz/crcs/ectester/common/ec/CustomECParameterSpec.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/cz/crcs/ectester/common/ec/CustomECParameterSpec.java')
-rw-r--r--src/cz/crcs/ectester/common/ec/CustomECParameterSpec.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/cz/crcs/ectester/common/ec/CustomECParameterSpec.java b/src/cz/crcs/ectester/common/ec/CustomECParameterSpec.java
new file mode 100644
index 0000000..cbc15e7
--- /dev/null
+++ b/src/cz/crcs/ectester/common/ec/CustomECParameterSpec.java
@@ -0,0 +1,47 @@
+package cz.crcs.ectester.common.ec;
+
+import java.math.BigInteger;
+import java.security.spec.ECFieldFp;
+import java.security.spec.ECParameterSpec;
+import java.security.spec.ECPoint;
+import java.security.spec.EllipticCurve;
+
+/**
+ * @author David Hofman
+ */
+public class CustomECParameterSpec extends ECParameterSpec {
+ private EllipticCurve curve;
+ private ECPoint g;
+ private BigInteger n;
+ private int h;
+
+ public CustomECParameterSpec(EllipticCurve curve, ECPoint g, BigInteger n, int h) {
+ //feed the constructor of the superclass some default, valid data
+ //getters will return custom (and possibly invalid) parameters instead
+ super(new EllipticCurve(new ECFieldFp(BigInteger.ONE),BigInteger.ZERO,BigInteger.ZERO), new ECPoint(BigInteger.ZERO, BigInteger.ZERO), BigInteger.ONE, 1);
+ this.curve = curve;
+ this.g = g;
+ this.n = n;
+ this.h = h;
+ }
+
+ @Override
+ public EllipticCurve getCurve() {
+ return curve;
+ }
+
+ @Override
+ public ECPoint getGenerator() {
+ return g;
+ }
+
+ @Override
+ public BigInteger getOrder() {
+ return n;
+ }
+
+ @Override
+ public int getCofactor() {
+ return h;
+ }
+}