From d81aefcbd4adf972b04133a2c52f890351dfbcf7 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Wed, 12 Mar 2014 14:46:56 +0700 Subject: Add new createRawPoint method on ECCurve that includes the Z coords --- core/src/main/java/org/bouncycastle/math/ec/ECCurve.java | 12 ++++++++++++ .../org/bouncycastle/math/ec/custom/sec/SecP192K1Curve.java | 5 +++++ .../org/bouncycastle/math/ec/custom/sec/SecP192R1Curve.java | 5 +++++ .../org/bouncycastle/math/ec/custom/sec/SecP224K1Curve.java | 5 +++++ .../org/bouncycastle/math/ec/custom/sec/SecP224R1Curve.java | 5 +++++ .../org/bouncycastle/math/ec/custom/sec/SecP256K1Curve.java | 5 +++++ .../org/bouncycastle/math/ec/custom/sec/SecP256R1Curve.java | 5 +++++ .../org/bouncycastle/math/ec/custom/sec/SecP384R1Curve.java | 5 +++++ .../org/bouncycastle/math/ec/custom/sec/SecP521R1Curve.java | 5 +++++ 9 files changed, 52 insertions(+) (limited to 'core/src/main/java/org') diff --git a/core/src/main/java/org/bouncycastle/math/ec/ECCurve.java b/core/src/main/java/org/bouncycastle/math/ec/ECCurve.java index 11cc2683..f9418d63 100644 --- a/core/src/main/java/org/bouncycastle/math/ec/ECCurve.java +++ b/core/src/main/java/org/bouncycastle/math/ec/ECCurve.java @@ -111,6 +111,8 @@ public abstract class ECCurve protected abstract ECPoint createRawPoint(ECFieldElement x, ECFieldElement y, boolean withCompression); + protected abstract ECPoint createRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, boolean withCompression); + protected ECMultiplier createDefaultMultiplier() { return new WNafL2RMultiplier(); @@ -463,6 +465,11 @@ public abstract class ECCurve return new ECPoint.Fp(this, x, y, withCompression); } + protected ECPoint createRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, boolean withCompression) + { + return new ECPoint.Fp(this, x, y, zs, withCompression); + } + public ECPoint importPoint(ECPoint p) { if (this != p.getCurve() && this.getCoordinateSystem() == COORD_JACOBIAN && !p.isInfinity()) @@ -824,6 +831,11 @@ public abstract class ECCurve return new ECPoint.F2m(this, x, y, withCompression); } + protected ECPoint createRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, boolean withCompression) + { + return new ECPoint.F2m(this, x, y, zs, withCompression); + } + public ECPoint getInfinity() { return infinity; diff --git a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP192K1Curve.java b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP192K1Curve.java index b26348cd..cd122b63 100644 --- a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP192K1Curve.java +++ b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP192K1Curve.java @@ -68,6 +68,11 @@ public class SecP192K1Curve extends ECCurve return new SecP192K1Point(this, x, y, withCompression); } + protected ECPoint createRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, boolean withCompression) + { + return new SecP192K1Point(this, x, y, zs, withCompression); + } + protected ECPoint decompressPoint(int yTilde, BigInteger X1) { ECFieldElement x = fromBigInteger(X1); diff --git a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP192R1Curve.java b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP192R1Curve.java index 8e00c5bc..5491609b 100644 --- a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP192R1Curve.java +++ b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP192R1Curve.java @@ -69,6 +69,11 @@ public class SecP192R1Curve extends ECCurve return new SecP192R1Point(this, x, y, withCompression); } + protected ECPoint createRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, boolean withCompression) + { + return new SecP192R1Point(this, x, y, zs, withCompression); + } + protected ECPoint decompressPoint(int yTilde, BigInteger X1) { ECFieldElement x = fromBigInteger(X1); diff --git a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP224K1Curve.java b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP224K1Curve.java index 4580da4e..44598908 100644 --- a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP224K1Curve.java +++ b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP224K1Curve.java @@ -67,6 +67,11 @@ public class SecP224K1Curve extends ECCurve return new SecP224K1Point(this, x, y, withCompression); } + protected ECPoint createRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, boolean withCompression) + { + return new SecP224K1Point(this, x, y, zs, withCompression); + } + protected ECPoint decompressPoint(int yTilde, BigInteger X1) { ECFieldElement x = fromBigInteger(X1); diff --git a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP224R1Curve.java b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP224R1Curve.java index 598b4a72..bbb02701 100644 --- a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP224R1Curve.java +++ b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP224R1Curve.java @@ -69,6 +69,11 @@ public class SecP224R1Curve extends ECCurve return new SecP224R1Point(this, x, y, withCompression); } + protected ECPoint createRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, boolean withCompression) + { + return new SecP224R1Point(this, x, y, zs, withCompression); + } + protected ECPoint decompressPoint(int yTilde, BigInteger X1) { ECFieldElement x = fromBigInteger(X1); diff --git a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP256K1Curve.java b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP256K1Curve.java index 39c730d1..2bd04a1f 100644 --- a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP256K1Curve.java +++ b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP256K1Curve.java @@ -67,6 +67,11 @@ public class SecP256K1Curve extends ECCurve return new SecP256K1Point(this, x, y, withCompression); } + protected ECPoint createRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, boolean withCompression) + { + return new SecP256K1Point(this, x, y, zs, withCompression); + } + protected ECPoint decompressPoint(int yTilde, BigInteger X1) { ECFieldElement x = fromBigInteger(X1); diff --git a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP256R1Curve.java b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP256R1Curve.java index f27ac876..ae3bfacb 100644 --- a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP256R1Curve.java +++ b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP256R1Curve.java @@ -69,6 +69,11 @@ public class SecP256R1Curve extends ECCurve return new SecP256R1Point(this, x, y, withCompression); } + protected ECPoint createRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, boolean withCompression) + { + return new SecP256R1Point(this, x, y, zs, withCompression); + } + protected ECPoint decompressPoint(int yTilde, BigInteger X1) { ECFieldElement x = fromBigInteger(X1); diff --git a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP384R1Curve.java b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP384R1Curve.java index ede502e2..ad37b0cd 100644 --- a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP384R1Curve.java +++ b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP384R1Curve.java @@ -69,6 +69,11 @@ public class SecP384R1Curve extends ECCurve return new SecP384R1Point(this, x, y, withCompression); } + protected ECPoint createRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, boolean withCompression) + { + return new SecP384R1Point(this, x, y, zs, withCompression); + } + protected ECPoint decompressPoint(int yTilde, BigInteger X1) { ECFieldElement x = fromBigInteger(X1); diff --git a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP521R1Curve.java b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP521R1Curve.java index b58e34b7..ea42b578 100644 --- a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP521R1Curve.java +++ b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP521R1Curve.java @@ -69,6 +69,11 @@ public class SecP521R1Curve extends ECCurve return new SecP521R1Point(this, x, y, withCompression); } + protected ECPoint createRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, boolean withCompression) + { + return new SecP521R1Point(this, x, y, zs, withCompression); + } + protected ECPoint decompressPoint(int yTilde, BigInteger X1) { ECFieldElement x = fromBigInteger(X1); -- cgit v1.2.3