From 2ebe9502a210e5d642664c33c723cdcf3ce5f88c Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Thu, 13 Mar 2014 13:04:05 +0700 Subject: Add new CreateRawPoint method on ECCurve that includes the Z coords --- crypto/src/math/ec/ECCurve.cs | 12 ++++++++++++ crypto/src/math/ec/custom/sec/SecP192K1Curve.cs | 5 +++++ crypto/src/math/ec/custom/sec/SecP192R1Curve.cs | 5 +++++ crypto/src/math/ec/custom/sec/SecP224K1Curve.cs | 5 +++++ crypto/src/math/ec/custom/sec/SecP224R1Curve.cs | 5 +++++ crypto/src/math/ec/custom/sec/SecP256K1Curve.cs | 5 +++++ crypto/src/math/ec/custom/sec/SecP256R1Curve.cs | 5 +++++ crypto/src/math/ec/custom/sec/SecP384R1Curve.cs | 5 +++++ crypto/src/math/ec/custom/sec/SecP521R1Curve.cs | 5 +++++ 9 files changed, 52 insertions(+) (limited to 'crypto') diff --git a/crypto/src/math/ec/ECCurve.cs b/crypto/src/math/ec/ECCurve.cs index f8ea8ba3c..a84863ce6 100644 --- a/crypto/src/math/ec/ECCurve.cs +++ b/crypto/src/math/ec/ECCurve.cs @@ -106,6 +106,8 @@ namespace Org.BouncyCastle.Math.EC protected internal abstract ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression); + protected internal abstract ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression); + protected virtual ECMultiplier CreateDefaultMultiplier() { return new WNafL2RMultiplier(); @@ -459,6 +461,11 @@ namespace Org.BouncyCastle.Math.EC return new FpPoint(this, x, y, withCompression); } + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + { + return new FpPoint(this, x, y, zs, withCompression); + } + public override ECPoint ImportPoint(ECPoint p) { if (this != p.Curve && this.CoordinateSystem == COORD_JACOBIAN && !p.IsInfinity) @@ -827,6 +834,11 @@ namespace Org.BouncyCastle.Math.EC return new F2mPoint(this, x, y, withCompression); } + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + { + return new F2mPoint(this, x, y, zs, withCompression); + } + public override ECPoint Infinity { get { return m_infinity; } diff --git a/crypto/src/math/ec/custom/sec/SecP192K1Curve.cs b/crypto/src/math/ec/custom/sec/SecP192K1Curve.cs index ab509b9fa..54b87588b 100644 --- a/crypto/src/math/ec/custom/sec/SecP192K1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP192K1Curve.cs @@ -68,6 +68,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecP192K1Point(this, x, y, withCompression); } + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + { + return new SecP192K1Point(this, x, y, zs, withCompression); + } + protected override ECPoint DecompressPoint(int yTilde, BigInteger X1) { ECFieldElement x = FromBigInteger(X1); diff --git a/crypto/src/math/ec/custom/sec/SecP192R1Curve.cs b/crypto/src/math/ec/custom/sec/SecP192R1Curve.cs index 62cb6f510..57b20d31e 100644 --- a/crypto/src/math/ec/custom/sec/SecP192R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP192R1Curve.cs @@ -71,6 +71,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecP192R1Point(this, x, y, withCompression); } + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + { + return new SecP192R1Point(this, x, y, zs, withCompression); + } + protected override ECPoint DecompressPoint(int yTilde, BigInteger X1) { ECFieldElement x = FromBigInteger(X1); diff --git a/crypto/src/math/ec/custom/sec/SecP224K1Curve.cs b/crypto/src/math/ec/custom/sec/SecP224K1Curve.cs index 5d82eaed8..70de308bb 100644 --- a/crypto/src/math/ec/custom/sec/SecP224K1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP224K1Curve.cs @@ -68,6 +68,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecP224K1Point(this, x, y, withCompression); } + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + { + return new SecP224K1Point(this, x, y, zs, withCompression); + } + protected override ECPoint DecompressPoint(int yTilde, BigInteger X1) { ECFieldElement x = FromBigInteger(X1); diff --git a/crypto/src/math/ec/custom/sec/SecP224R1Curve.cs b/crypto/src/math/ec/custom/sec/SecP224R1Curve.cs index ee0aa94a4..33b66be82 100644 --- a/crypto/src/math/ec/custom/sec/SecP224R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP224R1Curve.cs @@ -71,6 +71,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecP224R1Point(this, x, y, withCompression); } + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + { + return new SecP224R1Point(this, x, y, zs, withCompression); + } + protected override ECPoint DecompressPoint(int yTilde, BigInteger X1) { ECFieldElement x = FromBigInteger(X1); diff --git a/crypto/src/math/ec/custom/sec/SecP256K1Curve.cs b/crypto/src/math/ec/custom/sec/SecP256K1Curve.cs index a938a67d7..89de61706 100644 --- a/crypto/src/math/ec/custom/sec/SecP256K1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP256K1Curve.cs @@ -68,6 +68,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecP256K1Point(this, x, y, withCompression); } + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + { + return new SecP256K1Point(this, x, y, zs, withCompression); + } + protected override ECPoint DecompressPoint(int yTilde, BigInteger X1) { ECFieldElement x = FromBigInteger(X1); diff --git a/crypto/src/math/ec/custom/sec/SecP256R1Curve.cs b/crypto/src/math/ec/custom/sec/SecP256R1Curve.cs index 9525c0207..9a94eb8d1 100644 --- a/crypto/src/math/ec/custom/sec/SecP256R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP256R1Curve.cs @@ -70,6 +70,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecP256R1Point(this, x, y, withCompression); } + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + { + return new SecP256R1Point(this, x, y, zs, withCompression); + } + protected override ECPoint DecompressPoint(int yTilde, BigInteger X1) { ECFieldElement x = FromBigInteger(X1); diff --git a/crypto/src/math/ec/custom/sec/SecP384R1Curve.cs b/crypto/src/math/ec/custom/sec/SecP384R1Curve.cs index 9366232c6..f3dec05c9 100644 --- a/crypto/src/math/ec/custom/sec/SecP384R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP384R1Curve.cs @@ -70,6 +70,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecP384R1Point(this, x, y, withCompression); } + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + { + return new SecP384R1Point(this, x, y, zs, withCompression); + } + protected override ECPoint DecompressPoint(int yTilde, BigInteger X1) { ECFieldElement x = FromBigInteger(X1); diff --git a/crypto/src/math/ec/custom/sec/SecP521R1Curve.cs b/crypto/src/math/ec/custom/sec/SecP521R1Curve.cs index 24a0a5e33..cb42304ef 100644 --- a/crypto/src/math/ec/custom/sec/SecP521R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP521R1Curve.cs @@ -70,6 +70,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecP521R1Point(this, x, y, withCompression); } + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + { + return new SecP521R1Point(this, x, y, zs, withCompression); + } + protected override ECPoint DecompressPoint(int yTilde, BigInteger X1) { ECFieldElement x = FromBigInteger(X1); -- cgit 1.4.1