diff options
author | Peter Dettman <peter.dettman@gmail.com> | 2022-06-21 21:14:47 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@gmail.com> | 2022-06-21 21:14:47 +0700 |
commit | 7ca8774497c8e5c46fb67369909d4d9a87cbeb3f (patch) | |
tree | e7ab545ca1b51d48f3506ccbf310c34275d2f8ac /crypto/src/math | |
parent | Remove legacy TLS (diff) | |
download | BouncyCastle.NET-ed25519-7ca8774497c8e5c46fb67369909d4d9a87cbeb3f.tar.xz |
Remove per-ECPoint compression
Diffstat (limited to 'crypto/src/math')
66 files changed, 570 insertions, 1329 deletions
diff --git a/crypto/src/math/ec/ECCurve.cs b/crypto/src/math/ec/ECCurve.cs index 3861dc4cb..c0e27a449 100644 --- a/crypto/src/math/ec/ECCurve.cs +++ b/crypto/src/math/ec/ECCurve.cs @@ -112,39 +112,21 @@ namespace Org.BouncyCastle.Math.EC { ECPoint p = CreatePoint(x, y); if (!p.IsValid()) - { throw new ArgumentException("Invalid point coordinates"); - } - return p; - } - [Obsolete("Per-point compression property will be removed")] - public virtual ECPoint ValidatePoint(BigInteger x, BigInteger y, bool withCompression) - { - ECPoint p = CreatePoint(x, y, withCompression); - if (!p.IsValid()) - { - throw new ArgumentException("Invalid point coordinates"); - } return p; } public virtual ECPoint CreatePoint(BigInteger x, BigInteger y) { - return CreatePoint(x, y, false); - } - - [Obsolete("Per-point compression property will be removed")] - public virtual ECPoint CreatePoint(BigInteger x, BigInteger y, bool withCompression) - { - return CreateRawPoint(FromBigInteger(x), FromBigInteger(y), withCompression); + return CreateRawPoint(FromBigInteger(x), FromBigInteger(y)); } protected abstract ECCurve CloneCurve(); - protected internal abstract ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression); + protected internal abstract ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y); - protected internal abstract ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression); + protected internal abstract ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs); protected virtual ECMultiplier CreateDefaultMultiplier() { @@ -235,7 +217,7 @@ namespace Org.BouncyCastle.Math.EC // TODO Default behaviour could be improved if the two curves have the same coordinate system by copying any Z coordinates. p = p.Normalize(); - return CreatePoint(p.XCoord.ToBigInteger(), p.YCoord.ToBigInteger(), p.IsCompressed); + return CreatePoint(p.XCoord.ToBigInteger(), p.YCoord.ToBigInteger()); } /** @@ -583,7 +565,7 @@ namespace Org.BouncyCastle.Math.EC { ECFieldElement X = m_outer.FromBigInteger(new BigInteger(1, x)); ECFieldElement Y = m_outer.FromBigInteger(new BigInteger(1, y)); - return m_outer.CreateRawPoint(X, Y, false); + return m_outer.CreateRawPoint(X, Y); } } } @@ -643,7 +625,7 @@ namespace Org.BouncyCastle.Math.EC y = y.Negate(); } - return CreateRawPoint(x, y, true); + return CreateRawPoint(x, y); } private static BigInteger ImplRandomFieldElement(SecureRandom r, BigInteger p) @@ -730,7 +712,7 @@ namespace Org.BouncyCastle.Math.EC } this.m_r = FpFieldElement.CalculateResidue(q); - this.m_infinity = new FpPoint(this, null, null, false); + this.m_infinity = new FpPoint(this, null, null); this.m_a = FromBigInteger(a); this.m_b = FromBigInteger(b); @@ -750,7 +732,7 @@ namespace Org.BouncyCastle.Math.EC { this.m_q = q; this.m_r = r; - this.m_infinity = new FpPoint(this, null, null, false); + this.m_infinity = new FpPoint(this, null, null); this.m_a = a; this.m_b = b; @@ -798,14 +780,14 @@ namespace Org.BouncyCastle.Math.EC return new FpFieldElement(this.m_q, this.m_r, x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new FpPoint(this, x, y, withCompression); + return new FpPoint(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new FpPoint(this, x, y, zs, withCompression); + return new FpPoint(this, x, y, zs); } public override ECPoint ImportPoint(ECPoint p) @@ -820,8 +802,7 @@ namespace Org.BouncyCastle.Math.EC return new FpPoint(this, FromBigInteger(p.RawXCoord.ToBigInteger()), FromBigInteger(p.RawYCoord.ToBigInteger()), - new ECFieldElement[] { FromBigInteger(p.GetZCoord(0).ToBigInteger()) }, - p.IsCompressed); + new ECFieldElement[] { FromBigInteger(p.GetZCoord(0).ToBigInteger()) }); default: break; } @@ -925,8 +906,7 @@ namespace Org.BouncyCastle.Math.EC { } - [Obsolete("Per-point compression property will be removed")] - public override ECPoint CreatePoint(BigInteger x, BigInteger y, bool withCompression) + public override ECPoint CreatePoint(BigInteger x, BigInteger y) { ECFieldElement X = FromBigInteger(x), Y = FromBigInteger(y); @@ -953,7 +933,7 @@ namespace Org.BouncyCastle.Math.EC } } - return CreateRawPoint(X, Y, withCompression); + return CreateRawPoint(X, Y); } public override bool IsValidFieldElement(BigInteger x) @@ -1018,7 +998,7 @@ namespace Org.BouncyCastle.Math.EC if (yp == null) throw new ArgumentException("Invalid point compression"); - return CreateRawPoint(xp, yp, true); + return CreateRawPoint(xp, yp); } /** @@ -1290,7 +1270,7 @@ namespace Org.BouncyCastle.Math.EC this.k3 = k3; this.m_order = order; this.m_cofactor = cofactor; - this.m_infinity = new F2mPoint(this, null, null, false); + this.m_infinity = new F2mPoint(this, null, null); if (k1 == 0) throw new ArgumentException("k1 must be > 0"); @@ -1324,7 +1304,7 @@ namespace Org.BouncyCastle.Math.EC this.m_order = order; this.m_cofactor = cofactor; - this.m_infinity = new F2mPoint(this, null, null, false); + this.m_infinity = new F2mPoint(this, null, null); this.m_a = a; this.m_b = b; this.m_coord = F2M_DEFAULT_COORDS; @@ -1368,14 +1348,14 @@ namespace Org.BouncyCastle.Math.EC return new F2mFieldElement(this.m, this.k1, this.k2, this.k3, x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new F2mPoint(this, x, y, withCompression); + return new F2mPoint(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new F2mPoint(this, x, y, zs, withCompression); + return new F2mPoint(this, x, y, zs); } public override ECPoint Infinity @@ -1494,7 +1474,7 @@ namespace Org.BouncyCastle.Math.EC ECFieldElement X = new F2mFieldElement(m, ks, new LongArray(x)); ECFieldElement Y = new F2mFieldElement(m, ks, new LongArray(y)); - return m_outer.CreateRawPoint(X, Y, false); + return m_outer.CreateRawPoint(X, Y); } } } diff --git a/crypto/src/math/ec/ECPoint.cs b/crypto/src/math/ec/ECPoint.cs index 2a9d0832a..f32376455 100644 --- a/crypto/src/math/ec/ECPoint.cs +++ b/crypto/src/math/ec/ECPoint.cs @@ -50,23 +50,21 @@ namespace Org.BouncyCastle.Math.EC protected internal readonly ECCurve m_curve; protected internal readonly ECFieldElement m_x, m_y; protected internal readonly ECFieldElement[] m_zs; - protected internal readonly bool m_withCompression; // Dictionary is (string -> PreCompInfo) protected internal IDictionary m_preCompTable = null; - protected ECPoint(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : this(curve, x, y, GetInitialZCoords(curve), withCompression) + protected ECPoint(ECCurve curve, ECFieldElement x, ECFieldElement y) + : this(curve, x, y, GetInitialZCoords(curve)) { } - internal ECPoint(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + internal ECPoint(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { this.m_curve = curve; this.m_x = x; this.m_y = y; this.m_zs = zs; - this.m_withCompression = withCompression; } protected abstract bool SatisfiesCurveEquation(); @@ -284,7 +282,7 @@ namespace Org.BouncyCastle.Math.EC protected virtual ECPoint CreateScaledPoint(ECFieldElement sx, ECFieldElement sy) { - return Curve.CreateRawPoint(RawXCoord.Multiply(sx), RawYCoord.Multiply(sy), IsCompressed); + return Curve.CreateRawPoint(RawXCoord.Multiply(sx), RawYCoord.Multiply(sy)); } public bool IsInfinity @@ -292,11 +290,6 @@ namespace Org.BouncyCastle.Math.EC get { return m_x == null && m_y == null; } } - public bool IsCompressed - { - get { return m_withCompression; } - } - public bool IsValid() { return ImplIsValid(false, true); @@ -321,28 +314,28 @@ namespace Org.BouncyCastle.Math.EC { return IsInfinity ? this - : Curve.CreateRawPoint(RawXCoord.Multiply(scale), RawYCoord, RawZCoords, IsCompressed); + : Curve.CreateRawPoint(RawXCoord.Multiply(scale), RawYCoord, RawZCoords); } public virtual ECPoint ScaleXNegateY(ECFieldElement scale) { return IsInfinity ? this - : Curve.CreateRawPoint(RawXCoord.Multiply(scale), RawYCoord.Negate(), RawZCoords, IsCompressed); + : Curve.CreateRawPoint(RawXCoord.Multiply(scale), RawYCoord.Negate(), RawZCoords); } public virtual ECPoint ScaleY(ECFieldElement scale) { return IsInfinity ? this - : Curve.CreateRawPoint(RawXCoord, RawYCoord.Multiply(scale), RawZCoords, IsCompressed); + : Curve.CreateRawPoint(RawXCoord, RawYCoord.Multiply(scale), RawZCoords); } public virtual ECPoint ScaleYNegateX(ECFieldElement scale) { return IsInfinity ? this - : Curve.CreateRawPoint(RawXCoord.Negate(), RawYCoord.Multiply(scale), RawZCoords, IsCompressed); + : Curve.CreateRawPoint(RawXCoord.Negate(), RawYCoord.Multiply(scale), RawZCoords); } public override bool Equals(object obj) @@ -440,7 +433,7 @@ namespace Org.BouncyCastle.Math.EC public virtual byte[] GetEncoded() { - return GetEncoded(m_withCompression); + return GetEncoded(false); } public abstract byte[] GetEncoded(bool compressed); @@ -527,17 +520,13 @@ namespace Org.BouncyCastle.Math.EC public abstract class ECPointBase : ECPoint { - protected internal ECPointBase( - ECCurve curve, - ECFieldElement x, - ECFieldElement y, - bool withCompression) - : base(curve, x, y, withCompression) + protected internal ECPointBase(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - protected internal ECPointBase(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + protected internal ECPointBase(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -547,9 +536,7 @@ namespace Org.BouncyCastle.Math.EC public override byte[] GetEncoded(bool compressed) { if (this.IsInfinity) - { return new byte[1]; - } ECPoint normed = Normalize(); @@ -588,13 +575,13 @@ namespace Org.BouncyCastle.Math.EC public abstract class AbstractFpPoint : ECPointBase { - protected AbstractFpPoint(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) + protected AbstractFpPoint(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - protected AbstractFpPoint(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + protected AbstractFpPoint(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -661,30 +648,21 @@ namespace Org.BouncyCastle.Math.EC public class FpPoint : AbstractFpPoint { - /** - * Create a point that encodes with or without point compression. - * - * @param curve the curve to use - * @param x affine x co-ordinate - * @param y affine y co-ordinate - * @param withCompression if true encode with point compression - */ - [Obsolete("Per-point compression property will be removed, see GetEncoded(bool)")] - public FpPoint(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) + internal FpPoint(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { if ((x == null) != (y == null)) throw new ArgumentException("Exactly one of the field elements is null"); } - internal FpPoint(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal FpPoint(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } protected override ECPoint Detach() { - return new FpPoint(null, AffineXCoord, AffineYCoord, false); + return new FpPoint(null, AffineXCoord, AffineYCoord); } public override ECFieldElement GetZCoord(int index) @@ -735,7 +713,7 @@ namespace Org.BouncyCastle.Math.EC ECFieldElement X3 = gamma.Square().Subtract(X1).Subtract(X2); ECFieldElement Y3 = gamma.Multiply(X1.Subtract(X3)).Subtract(Y1); - return new FpPoint(Curve, X3, Y3, IsCompressed); + return new FpPoint(Curve, X3, Y3); } case ECCurve.COORD_HOMOGENEOUS: @@ -777,7 +755,7 @@ namespace Org.BouncyCastle.Math.EC ECFieldElement Y3 = vSquaredV2.Subtract(A).MultiplyMinusProduct(u, u2, vCubed); ECFieldElement Z3 = vCubed.Multiply(w); - return new FpPoint(curve, X3, Y3, new ECFieldElement[] { Z3 }, IsCompressed); + return new FpPoint(curve, X3, Y3, new ECFieldElement[] { Z3 }); } case ECCurve.COORD_JACOBIAN: @@ -907,7 +885,7 @@ namespace Org.BouncyCastle.Math.EC zs = new ECFieldElement[] { Z3 }; } - return new FpPoint(curve, X3, Y3, zs, IsCompressed); + return new FpPoint(curve, X3, Y3, zs); } default: @@ -942,7 +920,7 @@ namespace Org.BouncyCastle.Math.EC ECFieldElement X3 = gamma.Square().Subtract(Two(X1)); ECFieldElement Y3 = gamma.Multiply(X1.Subtract(X3)).Subtract(Y1); - return new FpPoint(Curve, X3, Y3, IsCompressed); + return new FpPoint(Curve, X3, Y3); } case ECCurve.COORD_HOMOGENEOUS: @@ -972,7 +950,7 @@ namespace Org.BouncyCastle.Math.EC ECFieldElement _4sSquared = Z1IsOne ? Two(_2t) : _2s.Square(); ECFieldElement Z3 = Two(_4sSquared).Multiply(s); - return new FpPoint(curve, X3, Y3, new ECFieldElement[] { Z3 }, IsCompressed); + return new FpPoint(curve, X3, Y3, new ECFieldElement[] { Z3 }); } case ECCurve.COORD_JACOBIAN: @@ -1031,7 +1009,7 @@ namespace Org.BouncyCastle.Math.EC // Alternative calculation of Z3 using fast square //ECFieldElement Z3 = doubleProductFromSquares(Y1, Z1, Y1Squared, Z1Squared); - return new FpPoint(curve, X3, Y3, new ECFieldElement[] { Z3 }, IsCompressed); + return new FpPoint(curve, X3, Y3, new ECFieldElement[] { Z3 }); } case ECCurve.COORD_JACOBIAN_MODIFIED: @@ -1102,7 +1080,7 @@ namespace Org.BouncyCastle.Math.EC ECFieldElement X4 = (L2.Subtract(L1)).Multiply(L1.Add(L2)).Add(X2); ECFieldElement Y4 = (X1.Subtract(X4)).Multiply(L2).Subtract(Y1); - return new FpPoint(Curve, X4, Y4, IsCompressed); + return new FpPoint(Curve, X4, Y4); } case ECCurve.COORD_JACOBIAN_MODIFIED: { @@ -1151,7 +1129,7 @@ namespace Org.BouncyCastle.Math.EC ECFieldElement X4 = (L2.Subtract(L1)).Multiply(L1.Add(L2)).Add(X1); ECFieldElement Y4 = (X1.Subtract(X4)).Multiply(L2).Subtract(Y1); - return new FpPoint(Curve, X4, Y4, IsCompressed); + return new FpPoint(Curve, X4, Y4); } case ECCurve.COORD_JACOBIAN_MODIFIED: { @@ -1233,15 +1211,15 @@ namespace Org.BouncyCastle.Math.EC { case ECCurve.COORD_AFFINE: ECFieldElement zInv = Z1.Invert(), zInv2 = zInv.Square(), zInv3 = zInv2.Multiply(zInv); - return new FpPoint(curve, X1.Multiply(zInv2), Y1.Multiply(zInv3), IsCompressed); + return new FpPoint(curve, X1.Multiply(zInv2), Y1.Multiply(zInv3)); case ECCurve.COORD_HOMOGENEOUS: X1 = X1.Multiply(Z1); Z1 = Z1.Multiply(Z1.Square()); - return new FpPoint(curve, X1, Y1, new ECFieldElement[] { Z1 }, IsCompressed); + return new FpPoint(curve, X1, Y1, new ECFieldElement[] { Z1 }); case ECCurve.COORD_JACOBIAN: - return new FpPoint(curve, X1, Y1, new ECFieldElement[] { Z1 }, IsCompressed); + return new FpPoint(curve, X1, Y1, new ECFieldElement[] { Z1 }); case ECCurve.COORD_JACOBIAN_MODIFIED: - return new FpPoint(curve, X1, Y1, new ECFieldElement[] { Z1, W1 }, IsCompressed); + return new FpPoint(curve, X1, Y1, new ECFieldElement[] { Z1, W1 }); default: throw new InvalidOperationException("unsupported coordinate system"); } @@ -1287,10 +1265,10 @@ namespace Org.BouncyCastle.Math.EC if (ECCurve.COORD_AFFINE != coord) { - return new FpPoint(curve, RawXCoord, RawYCoord.Negate(), RawZCoords, IsCompressed); + return new FpPoint(curve, RawXCoord, RawYCoord.Negate(), RawZCoords); } - return new FpPoint(curve, RawXCoord, RawYCoord.Negate(), IsCompressed); + return new FpPoint(curve, RawXCoord, RawYCoord.Negate()); } protected virtual ECFieldElement CalculateJacobianModifiedW(ECFieldElement Z, ECFieldElement ZSquared) @@ -1345,20 +1323,20 @@ namespace Org.BouncyCastle.Math.EC ECFieldElement W3 = calculateW ? Two(_8T.Multiply(W1)) : null; ECFieldElement Z3 = Z1.IsOne ? _2Y1 : _2Y1.Multiply(Z1); - return new FpPoint(this.Curve, X3, Y3, new ECFieldElement[] { Z3, W3 }, IsCompressed); + return new FpPoint(this.Curve, X3, Y3, new ECFieldElement[] { Z3, W3 }); } } public abstract class AbstractF2mPoint : ECPointBase { - protected AbstractF2mPoint(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) + protected AbstractF2mPoint(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - protected AbstractF2mPoint(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + protected AbstractF2mPoint(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -1498,7 +1476,7 @@ namespace Org.BouncyCastle.Math.EC ECFieldElement X2 = X.Multiply(scale); ECFieldElement L2 = L.Add(X).Divide(scale).Add(X2); - return Curve.CreateRawPoint(X, L2, RawZCoords, IsCompressed); + return Curve.CreateRawPoint(X, L2, RawZCoords); } case ECCurve.COORD_LAMBDA_PROJECTIVE: { @@ -1510,7 +1488,7 @@ namespace Org.BouncyCastle.Math.EC ECFieldElement L2 = L.Add(X).Add(X2); ECFieldElement Z2 = Z.Multiply(scale); - return Curve.CreateRawPoint(X, L2, new ECFieldElement[] { Z2 }, IsCompressed); + return Curve.CreateRawPoint(X, L2, new ECFieldElement[] { Z2 }); } default: { @@ -1539,7 +1517,7 @@ namespace Org.BouncyCastle.Math.EC // Y is actually Lambda (X + Y/X) here ECFieldElement L2 = L.Add(X).Multiply(scale).Add(X); - return Curve.CreateRawPoint(X, L2, RawZCoords, IsCompressed); + return Curve.CreateRawPoint(X, L2, RawZCoords); } default: { @@ -1578,14 +1556,14 @@ namespace Org.BouncyCastle.Math.EC case ECCurve.COORD_LAMBDA_AFFINE: { ECFieldElement Y1 = this.RawYCoord; - return (AbstractF2mPoint)curve.CreateRawPoint(X1.Square(), Y1.Square(), IsCompressed); + return (AbstractF2mPoint)curve.CreateRawPoint(X1.Square(), Y1.Square()); } case ECCurve.COORD_HOMOGENEOUS: case ECCurve.COORD_LAMBDA_PROJECTIVE: { ECFieldElement Y1 = this.RawYCoord, Z1 = this.RawZCoords[0]; return (AbstractF2mPoint)curve.CreateRawPoint(X1.Square(), Y1.Square(), - new ECFieldElement[] { Z1.Square() }, IsCompressed); + new ECFieldElement[] { Z1.Square() }); } default: { @@ -1610,14 +1588,14 @@ namespace Org.BouncyCastle.Math.EC case ECCurve.COORD_LAMBDA_AFFINE: { ECFieldElement Y1 = this.RawYCoord; - return (AbstractF2mPoint)curve.CreateRawPoint(X1.SquarePow(pow), Y1.SquarePow(pow), IsCompressed); + return (AbstractF2mPoint)curve.CreateRawPoint(X1.SquarePow(pow), Y1.SquarePow(pow)); } case ECCurve.COORD_HOMOGENEOUS: case ECCurve.COORD_LAMBDA_PROJECTIVE: { ECFieldElement Y1 = this.RawYCoord, Z1 = this.RawZCoords[0]; return (AbstractF2mPoint)curve.CreateRawPoint(X1.SquarePow(pow), Y1.SquarePow(pow), - new ECFieldElement[] { Z1.SquarePow(pow) }, IsCompressed); + new ECFieldElement[] { Z1.SquarePow(pow) }); } default: { @@ -1633,19 +1611,8 @@ namespace Org.BouncyCastle.Math.EC public class F2mPoint : AbstractF2mPoint { - /** - * @param curve base curve - * @param x x point - * @param y y point - * @param withCompression true if encode with point compression. - */ - [Obsolete("Per-point compression property will be removed, see GetEncoded(bool)")] - public F2mPoint( - ECCurve curve, - ECFieldElement x, - ECFieldElement y, - bool withCompression) - : base(curve, x, y, withCompression) + internal F2mPoint(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { if ((x == null) != (y == null)) { @@ -1665,14 +1632,14 @@ namespace Org.BouncyCastle.Math.EC } } - internal F2mPoint(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal F2mPoint(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } protected override ECPoint Detach() { - return new F2mPoint(null, AffineXCoord, AffineYCoord, false); + return new F2mPoint(null, AffineXCoord, AffineYCoord); } public override ECFieldElement YCoord @@ -1775,7 +1742,7 @@ namespace Org.BouncyCastle.Math.EC ECFieldElement X3 = L.Square().Add(L).Add(dx).Add(curve.A); ECFieldElement Y3 = L.Multiply(X1.Add(X3)).Add(X3).Add(Y1); - return new F2mPoint(curve, X3, Y3, IsCompressed); + return new F2mPoint(curve, X3, Y3); } case ECCurve.COORD_HOMOGENEOUS: { @@ -1822,7 +1789,7 @@ namespace Org.BouncyCastle.Math.EC ECFieldElement Y3 = U.MultiplyPlusProduct(X1, V, Y1).MultiplyPlusProduct(VSqZ2, uv, A); ECFieldElement Z3 = VCu.Multiply(W); - return new F2mPoint(curve, X3, Y3, new ECFieldElement[] { Z3 }, IsCompressed); + return new F2mPoint(curve, X3, Y3, new ECFieldElement[] { Z3 }); } case ECCurve.COORD_LAMBDA_PROJECTIVE: { @@ -1880,7 +1847,7 @@ namespace Org.BouncyCastle.Math.EC X3 = L.Square().Add(L).Add(X1).Add(curve.A); if (X3.IsZero) { - return new F2mPoint(curve, X3, curve.B.Sqrt(), IsCompressed); + return new F2mPoint(curve, X3, curve.B.Sqrt()); } ECFieldElement Y3 = L.Multiply(X1.Add(X3)).Add(X3).Add(Y1); @@ -1897,7 +1864,7 @@ namespace Org.BouncyCastle.Math.EC X3 = AU1.Multiply(AU2); if (X3.IsZero) { - return new F2mPoint(curve, X3, curve.B.Sqrt(), IsCompressed); + return new F2mPoint(curve, X3, curve.B.Sqrt()); } ECFieldElement ABZ2 = A.Multiply(B); @@ -1915,7 +1882,7 @@ namespace Org.BouncyCastle.Math.EC } } - return new F2mPoint(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new F2mPoint(curve, X3, L3, new ECFieldElement[] { Z3 }); } default: { @@ -1954,7 +1921,7 @@ namespace Org.BouncyCastle.Math.EC ECFieldElement X3 = L1.Square().Add(L1).Add(curve.A); ECFieldElement Y3 = X1.SquarePlusProduct(X3, L1.AddOne()); - return new F2mPoint(curve, X3, Y3, IsCompressed); + return new F2mPoint(curve, X3, Y3); } case ECCurve.COORD_HOMOGENEOUS: { @@ -1975,7 +1942,7 @@ namespace Org.BouncyCastle.Math.EC ECFieldElement Y3 = X1Sq.Square().MultiplyPlusProduct(V, h, sv); ECFieldElement Z3 = V.Multiply(vSquared); - return new F2mPoint(curve, X3, Y3, new ECFieldElement[] { Z3 }, IsCompressed); + return new F2mPoint(curve, X3, Y3, new ECFieldElement[] { Z3 }); } case ECCurve.COORD_LAMBDA_PROJECTIVE: { @@ -1989,7 +1956,7 @@ namespace Org.BouncyCastle.Math.EC ECFieldElement T = L1.Square().Add(L1Z1).Add(aZ1Sq); if (T.IsZero) { - return new F2mPoint(curve, T, curve.B.Sqrt(), IsCompressed); + return new F2mPoint(curve, T, curve.B.Sqrt()); } ECFieldElement X3 = T.Square(); @@ -2026,7 +1993,7 @@ namespace Org.BouncyCastle.Math.EC L3 = X1Z1.SquarePlusProduct(T, L1Z1).Add(X3).Add(Z3); } - return new F2mPoint(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new F2mPoint(curve, X3, L3, new ECFieldElement[] { Z3 }); } default: { @@ -2090,14 +2057,14 @@ namespace Org.BouncyCastle.Math.EC if (A.IsZero) { - return new F2mPoint(curve, A, curve.B.Sqrt(), IsCompressed); + return new F2mPoint(curve, A, curve.B.Sqrt()); } ECFieldElement X3 = A.Square().Multiply(X2Z1Sq); ECFieldElement Z3 = A.Multiply(B).Multiply(Z1Sq); ECFieldElement L3 = A.Add(B).Square().MultiplyPlusProduct(T, L2plus1, Z3); - return new F2mPoint(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new F2mPoint(curve, X3, L3, new ECFieldElement[] { Z3 }); } default: { @@ -2123,23 +2090,23 @@ namespace Org.BouncyCastle.Math.EC case ECCurve.COORD_AFFINE: { ECFieldElement Y = this.RawYCoord; - return new F2mPoint(curve, X, Y.Add(X), IsCompressed); + return new F2mPoint(curve, X, Y.Add(X)); } case ECCurve.COORD_HOMOGENEOUS: { ECFieldElement Y = this.RawYCoord, Z = this.RawZCoords[0]; - return new F2mPoint(curve, X, Y.Add(X), new ECFieldElement[] { Z }, IsCompressed); + return new F2mPoint(curve, X, Y.Add(X), new ECFieldElement[] { Z }); } case ECCurve.COORD_LAMBDA_AFFINE: { ECFieldElement L = this.RawYCoord; - return new F2mPoint(curve, X, L.AddOne(), IsCompressed); + return new F2mPoint(curve, X, L.AddOne()); } case ECCurve.COORD_LAMBDA_PROJECTIVE: { // L is actually Lambda (X + Y/X) here ECFieldElement L = this.RawYCoord, Z = this.RawZCoords[0]; - return new F2mPoint(curve, X, L.Add(Z), new ECFieldElement[] { Z }, IsCompressed); + return new F2mPoint(curve, X, L.Add(Z), new ECFieldElement[] { Z }); } default: { diff --git a/crypto/src/math/ec/custom/djb/Curve25519.cs b/crypto/src/math/ec/custom/djb/Curve25519.cs index 2566af030..380be7252 100644 --- a/crypto/src/math/ec/custom/djb/Curve25519.cs +++ b/crypto/src/math/ec/custom/djb/Curve25519.cs @@ -68,14 +68,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Djb return new Curve25519FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new Curve25519Point(this, x, y, withCompression); + return new Curve25519Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new Curve25519Point(this, x, y, zs, withCompression); + return new Curve25519Point(this, x, y, zs); } public override ECLookupTable CreateCacheSafeLookupTable(ECPoint[] points, int off, int len) @@ -164,7 +164,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Djb private ECPoint CreatePoint(uint[] x, uint[] y) { - return m_outer.CreateRawPoint(new Curve25519FieldElement(x), new Curve25519FieldElement(y), CURVE25519_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new Curve25519FieldElement(x), new Curve25519FieldElement(y), CURVE25519_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/djb/Curve25519Point.cs b/crypto/src/math/ec/custom/djb/Curve25519Point.cs index eb8fc12f2..f61e28af8 100644 --- a/crypto/src/math/ec/custom/djb/Curve25519Point.cs +++ b/crypto/src/math/ec/custom/djb/Curve25519Point.cs @@ -7,39 +7,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Djb internal class Curve25519Point : AbstractFpPoint { - /** - * Create a point which encodes with point compression. - * - * @param curve the curve to use - * @param x affine x co-ordinate - * @param y affine y co-ordinate - * - * @deprecated Use ECCurve.CreatePoint to construct points - */ - public Curve25519Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal Curve25519Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * Create a point that encodes with or without point compresion. - * - * @param curve the curve to use - * @param x affine x co-ordinate - * @param y affine y co-ordinate - * @param withCompression if true encode with point compression - * - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(bool)} - */ - public Curve25519Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal Curve25519Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal Curve25519Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -178,7 +152,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Djb ECFieldElement[] zs = new ECFieldElement[] { Z3, W3 }; - return new Curve25519Point(curve, X3, Y3, zs, IsCompressed); + return new Curve25519Point(curve, X3, Y3, zs); } public override ECPoint Twice() @@ -224,7 +198,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Djb if (IsInfinity) return this; - return new Curve25519Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords, IsCompressed); + return new Curve25519Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords); } protected virtual Curve25519FieldElement CalculateJacobianModifiedW(Curve25519FieldElement Z, uint[] ZSquared) @@ -307,7 +281,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Djb Curve25519Field.Twice(W3.x, W3.x); } - return new Curve25519Point(this.Curve, X3, Y3, new ECFieldElement[] { Z3, W3 }, IsCompressed); + return new Curve25519Point(this.Curve, X3, Y3, new ECFieldElement[] { Z3, W3 }); } } } diff --git a/crypto/src/math/ec/custom/gm/SM2P256V1Curve.cs b/crypto/src/math/ec/custom/gm/SM2P256V1Curve.cs index 805245c45..ae6c6e1d9 100644 --- a/crypto/src/math/ec/custom/gm/SM2P256V1Curve.cs +++ b/crypto/src/math/ec/custom/gm/SM2P256V1Curve.cs @@ -67,14 +67,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.GM return new SM2P256V1FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SM2P256V1Point(this, x, y, withCompression); + return new SM2P256V1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SM2P256V1Point(this, x, y, zs, withCompression); + return new SM2P256V1Point(this, x, y, zs); } public override ECLookupTable CreateCacheSafeLookupTable(ECPoint[] points, int off, int len) @@ -163,7 +163,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.GM private ECPoint CreatePoint(uint[] x, uint[] y) { - return m_outer.CreateRawPoint(new SM2P256V1FieldElement(x), new SM2P256V1FieldElement(y), SM2P256V1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SM2P256V1FieldElement(x), new SM2P256V1FieldElement(y), SM2P256V1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/gm/SM2P256V1Point.cs b/crypto/src/math/ec/custom/gm/SM2P256V1Point.cs index 916c90633..aba4c3d8e 100644 --- a/crypto/src/math/ec/custom/gm/SM2P256V1Point.cs +++ b/crypto/src/math/ec/custom/gm/SM2P256V1Point.cs @@ -7,47 +7,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.GM internal class SM2P256V1Point : AbstractFpPoint { - /** - * Create a point which encodes with point compression. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * - * @deprecated Use ECCurve.createPoint to construct points - */ - public SM2P256V1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SM2P256V1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * Create a point that encodes with or without point compresion. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * @param withCompression - * if true encode with point compression - * - * @deprecated per-point compression property will be removed, refer - * {@link #getEncoded(bool)} - */ - public SM2P256V1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SM2P256V1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SM2P256V1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -172,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.GM ECFieldElement[] zs = new ECFieldElement[]{ Z3 }; - return new SM2P256V1Point(curve, X3, Y3, zs, IsCompressed); + return new SM2P256V1Point(curve, X3, Y3, zs); } public override ECPoint Twice() @@ -240,7 +206,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.GM SM2P256V1Field.Multiply(Z3.x, Z1.x, Z3.x); } - return new SM2P256V1Point(curve, X3, Y3, new ECFieldElement[]{ Z3 }, IsCompressed); + return new SM2P256V1Point(curve, X3, Y3, new ECFieldElement[]{ Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -273,7 +239,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.GM if (IsInfinity) return this; - return new SM2P256V1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords, IsCompressed); + return new SM2P256V1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP128R1Curve.cs b/crypto/src/math/ec/custom/sec/SecP128R1Curve.cs index b4a150ca0..a5fc338da 100644 --- a/crypto/src/math/ec/custom/sec/SecP128R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP128R1Curve.cs @@ -68,14 +68,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecP128R1FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecP128R1Point(this, x, y, withCompression); + return new SecP128R1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecP128R1Point(this, x, y, zs, withCompression); + return new SecP128R1Point(this, x, y, zs); } public override ECLookupTable CreateCacheSafeLookupTable(ECPoint[] points, int off, int len) @@ -164,7 +164,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(uint[] x, uint[] y) { - return m_outer.CreateRawPoint(new SecP128R1FieldElement(x), new SecP128R1FieldElement(y), SECP128R1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecP128R1FieldElement(x), new SecP128R1FieldElement(y), SECP128R1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP128R1Point.cs b/crypto/src/math/ec/custom/sec/SecP128R1Point.cs index ae76d3cd1..45d28298a 100644 --- a/crypto/src/math/ec/custom/sec/SecP128R1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecP128R1Point.cs @@ -7,47 +7,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP128R1Point : AbstractFpPoint { - /** - * Create a point which encodes with point compression. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecP128R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecP128R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * Create a point that encodes with or without point compresion. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * @param withCompression - * if true encode with point compression - * - * @deprecated per-point compression property will be removed, refer - * {@link #getEncoded(boolean)} - */ - public SecP128R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecP128R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecP128R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -172,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement[] zs = new ECFieldElement[]{ Z3 }; - return new SecP128R1Point(curve, X3, Y3, zs, IsCompressed); + return new SecP128R1Point(curve, X3, Y3, zs); } public override ECPoint Twice() @@ -240,7 +206,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec SecP128R1Field.Multiply(Z3.x, Z1.x, Z3.x); } - return new SecP128R1Point(curve, X3, Y3, new ECFieldElement[]{ Z3 }, IsCompressed); + return new SecP128R1Point(curve, X3, Y3, new ECFieldElement[]{ Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -273,7 +239,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (IsInfinity) return this; - return new SecP128R1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords, IsCompressed); + return new SecP128R1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP160K1Curve.cs b/crypto/src/math/ec/custom/sec/SecP160K1Curve.cs index c2c78e464..99318a2d8 100644 --- a/crypto/src/math/ec/custom/sec/SecP160K1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP160K1Curve.cs @@ -65,14 +65,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecP160R2FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecP160K1Point(this, x, y, withCompression); + return new SecP160K1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecP160K1Point(this, x, y, zs, withCompression); + return new SecP160K1Point(this, x, y, zs); } public override ECLookupTable CreateCacheSafeLookupTable(ECPoint[] points, int off, int len) @@ -161,7 +161,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(uint[] x, uint[] y) { - return m_outer.CreateRawPoint(new SecP160R2FieldElement(x), new SecP160R2FieldElement(y), SECP160K1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecP160R2FieldElement(x), new SecP160R2FieldElement(y), SECP160K1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP160K1Point.cs b/crypto/src/math/ec/custom/sec/SecP160K1Point.cs index 1bcbadb33..8a2309bd5 100644 --- a/crypto/src/math/ec/custom/sec/SecP160K1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecP160K1Point.cs @@ -7,48 +7,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP160K1Point : AbstractFpPoint { - /** - * Create a point which encodes with point compression. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * - * @deprecated Use ECCurve.CreatePoint to construct points - */ - public SecP160K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecP160K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * Create a point that encodes with or without point compresion. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * @param withCompression - * if true encode with point compression - * - * @deprecated per-point compression property will be removed, refer - * {@link #getEncoded(bool)} - */ - public SecP160K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecP160K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, - bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecP160K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -174,7 +139,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement[] zs = new ECFieldElement[] { Z3 }; - return new SecP160K1Point(curve, X3, Y3, zs, IsCompressed); + return new SecP160K1Point(curve, X3, Y3, zs); } // B.3 pg 62 @@ -230,7 +195,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec SecP160R2Field.Multiply(Z3.x, Z1.x, Z3.x); } - return new SecP160K1Point(curve, X3, Y3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecP160K1Point(curve, X3, Y3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -263,7 +228,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (IsInfinity) return this; - return new SecP160K1Point(Curve, this.RawXCoord, this.RawYCoord.Negate(), this.RawZCoords, IsCompressed); + return new SecP160K1Point(Curve, this.RawXCoord, this.RawYCoord.Negate(), this.RawZCoords); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP160R1Curve.cs b/crypto/src/math/ec/custom/sec/SecP160R1Curve.cs index 8ae519ad3..b3e90f82a 100644 --- a/crypto/src/math/ec/custom/sec/SecP160R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP160R1Curve.cs @@ -68,14 +68,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecP160R1FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecP160R1Point(this, x, y, withCompression); + return new SecP160R1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecP160R1Point(this, x, y, zs, withCompression); + return new SecP160R1Point(this, x, y, zs); } public override ECLookupTable CreateCacheSafeLookupTable(ECPoint[] points, int off, int len) @@ -164,7 +164,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(uint[] x, uint[] y) { - return m_outer.CreateRawPoint(new SecP160R1FieldElement(x), new SecP160R1FieldElement(y), SECP160R1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecP160R1FieldElement(x), new SecP160R1FieldElement(y), SECP160R1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP160R1Point.cs b/crypto/src/math/ec/custom/sec/SecP160R1Point.cs index f9f065de6..35495c95c 100644 --- a/crypto/src/math/ec/custom/sec/SecP160R1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecP160R1Point.cs @@ -7,47 +7,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP160R1Point : AbstractFpPoint { - /** - * Create a point which encodes with point compression. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * - * @deprecated Use ECCurve.CreatePoint to construct points - */ - public SecP160R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecP160R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * Create a point that encodes with or without point compresion. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * @param withCompression - * if true encode with point compression - * - * @deprecated per-point compression property will be removed, refer - * {@link #getEncoded(bool)} - */ - public SecP160R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecP160R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecP160R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -172,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement[] zs = new ECFieldElement[]{ Z3 }; - return new SecP160R1Point(curve, X3, Y3, zs, IsCompressed); + return new SecP160R1Point(curve, X3, Y3, zs); } public override ECPoint Twice() @@ -240,7 +206,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec SecP160R1Field.Multiply(Z3.x, Z1.x, Z3.x); } - return new SecP160R1Point(curve, X3, Y3, new ECFieldElement[]{ Z3 }, IsCompressed); + return new SecP160R1Point(curve, X3, Y3, new ECFieldElement[]{ Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -273,7 +239,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (IsInfinity) return this; - return new SecP160R1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords, IsCompressed); + return new SecP160R1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP160R2Curve.cs b/crypto/src/math/ec/custom/sec/SecP160R2Curve.cs index 49c3fa331..54a67d796 100644 --- a/crypto/src/math/ec/custom/sec/SecP160R2Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP160R2Curve.cs @@ -68,14 +68,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecP160R2FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecP160R2Point(this, x, y, withCompression); + return new SecP160R2Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecP160R2Point(this, x, y, zs, withCompression); + return new SecP160R2Point(this, x, y, zs); } public override ECLookupTable CreateCacheSafeLookupTable(ECPoint[] points, int off, int len) @@ -164,7 +164,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(uint[] x, uint[] y) { - return m_outer.CreateRawPoint(new SecP160R2FieldElement(x), new SecP160R2FieldElement(y), SECP160R2_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecP160R2FieldElement(x), new SecP160R2FieldElement(y), SECP160R2_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP160R2Point.cs b/crypto/src/math/ec/custom/sec/SecP160R2Point.cs index 343cf8c16..5bcb944af 100644 --- a/crypto/src/math/ec/custom/sec/SecP160R2Point.cs +++ b/crypto/src/math/ec/custom/sec/SecP160R2Point.cs @@ -7,47 +7,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP160R2Point : AbstractFpPoint { - /** - * Create a point which encodes with point compression. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * - * @deprecated Use ECCurve.CreatePoint to construct points - */ - public SecP160R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecP160R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * Create a point that encodes with or without point compresion. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * @param withCompression - * if true encode with point compression - * - * @deprecated per-point compression property will be removed, refer - * {@link #getEncoded(bool)} - */ - public SecP160R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecP160R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecP160R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -172,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement[] zs = new ECFieldElement[]{ Z3 }; - return new SecP160R2Point(curve, X3, Y3, zs, IsCompressed); + return new SecP160R2Point(curve, X3, Y3, zs); } public override ECPoint Twice() @@ -240,7 +206,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec SecP160R2Field.Multiply(Z3.x, Z1.x, Z3.x); } - return new SecP160R2Point(curve, X3, Y3, new ECFieldElement[]{ Z3 }, IsCompressed); + return new SecP160R2Point(curve, X3, Y3, new ECFieldElement[]{ Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -273,7 +239,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (IsInfinity) return this; - return new SecP160R2Point(Curve, this.RawXCoord, this.RawYCoord.Negate(), this.RawZCoords, IsCompressed); + return new SecP160R2Point(Curve, this.RawXCoord, this.RawYCoord.Negate(), this.RawZCoords); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP192K1Curve.cs b/crypto/src/math/ec/custom/sec/SecP192K1Curve.cs index b9fb08e56..9e73e5d51 100644 --- a/crypto/src/math/ec/custom/sec/SecP192K1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP192K1Curve.cs @@ -65,14 +65,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecP192K1FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecP192K1Point(this, x, y, withCompression); + return new SecP192K1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecP192K1Point(this, x, y, zs, withCompression); + return new SecP192K1Point(this, x, y, zs); } public override ECLookupTable CreateCacheSafeLookupTable(ECPoint[] points, int off, int len) @@ -161,7 +161,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(uint[] x, uint[] y) { - return m_outer.CreateRawPoint(new SecP192K1FieldElement(x), new SecP192K1FieldElement(y), SECP192K1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecP192K1FieldElement(x), new SecP192K1FieldElement(y), SECP192K1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP192K1Point.cs b/crypto/src/math/ec/custom/sec/SecP192K1Point.cs index 58eb09102..3098f7a84 100644 --- a/crypto/src/math/ec/custom/sec/SecP192K1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecP192K1Point.cs @@ -7,48 +7,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP192K1Point : AbstractFpPoint { - /** - * Create a point which encodes with point compression. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecP192K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecP192K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * Create a point that encodes with or without point compresion. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * @param withCompression - * if true encode with point compression - * - * @deprecated per-point compression property will be removed, refer - * {@link #getEncoded(bool)} - */ - public SecP192K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecP192K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, - bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecP192K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -173,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement[] zs = new ECFieldElement[] { Z3 }; - return new SecP192K1Point(curve, X3, Y3, zs, IsCompressed); + return new SecP192K1Point(curve, X3, Y3, zs); } public override ECPoint Twice() @@ -228,7 +193,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec SecP192K1Field.Multiply(Z3.x, Z1.x, Z3.x); } - return new SecP192K1Point(curve, X3, Y3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecP192K1Point(curve, X3, Y3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -261,7 +226,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (IsInfinity) return this; - return new SecP192K1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords, IsCompressed); + return new SecP192K1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP192R1Curve.cs b/crypto/src/math/ec/custom/sec/SecP192R1Curve.cs index 465768514..fb9e0f7ad 100644 --- a/crypto/src/math/ec/custom/sec/SecP192R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP192R1Curve.cs @@ -68,14 +68,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecP192R1FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecP192R1Point(this, x, y, withCompression); + return new SecP192R1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecP192R1Point(this, x, y, zs, withCompression); + return new SecP192R1Point(this, x, y, zs); } public override ECLookupTable CreateCacheSafeLookupTable(ECPoint[] points, int off, int len) @@ -164,7 +164,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(uint[] x, uint[] y) { - return m_outer.CreateRawPoint(new SecP192R1FieldElement(x), new SecP192R1FieldElement(y), SECP192R1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecP192R1FieldElement(x), new SecP192R1FieldElement(y), SECP192R1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP192R1Point.cs b/crypto/src/math/ec/custom/sec/SecP192R1Point.cs index 3b53e341e..6c2152134 100644 --- a/crypto/src/math/ec/custom/sec/SecP192R1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecP192R1Point.cs @@ -7,47 +7,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP192R1Point : AbstractFpPoint { - /** - * Create a point which encodes with point compression. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecP192R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecP192R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * Create a point that encodes with or without point compresion. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * @param withCompression - * if true encode with point compression - * - * @deprecated per-point compression property will be removed, refer - * {@link #getEncoded(bool)} - */ - public SecP192R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecP192R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecP192R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -172,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement[] zs = new ECFieldElement[] { Z3 }; - return new SecP192R1Point(curve, X3, Y3, zs, IsCompressed); + return new SecP192R1Point(curve, X3, Y3, zs); } public override ECPoint Twice() @@ -240,7 +206,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec SecP192R1Field.Multiply(Z3.x, Z1.x, Z3.x); } - return new SecP192R1Point(curve, X3, Y3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecP192R1Point(curve, X3, Y3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -273,7 +239,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (IsInfinity) return this; - return new SecP192R1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords, IsCompressed); + return new SecP192R1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP224K1Curve.cs b/crypto/src/math/ec/custom/sec/SecP224K1Curve.cs index dc5cd6c0b..91af66685 100644 --- a/crypto/src/math/ec/custom/sec/SecP224K1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP224K1Curve.cs @@ -65,14 +65,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecP224K1FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecP224K1Point(this, x, y, withCompression); + return new SecP224K1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecP224K1Point(this, x, y, zs, withCompression); + return new SecP224K1Point(this, x, y, zs); } public override ECLookupTable CreateCacheSafeLookupTable(ECPoint[] points, int off, int len) @@ -161,7 +161,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(uint[] x, uint[] y) { - return m_outer.CreateRawPoint(new SecP224K1FieldElement(x), new SecP224K1FieldElement(y), SECP224K1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecP224K1FieldElement(x), new SecP224K1FieldElement(y), SECP224K1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP224K1Point.cs b/crypto/src/math/ec/custom/sec/SecP224K1Point.cs index 98cb29274..6a163e4ff 100644 --- a/crypto/src/math/ec/custom/sec/SecP224K1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecP224K1Point.cs @@ -7,48 +7,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP224K1Point : AbstractFpPoint { - /** - * Create a point which encodes with point compression. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecP224K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecP224K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * Create a point that encodes with or without point compresion. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * @param withCompression - * if true encode with point compression - * - * @deprecated per-point compression property will be removed, refer - * {@link #getEncoded(bool)} - */ - public SecP224K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecP224K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, - bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecP224K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -173,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement[] zs = new ECFieldElement[] { Z3 }; - return new SecP224K1Point(curve, X3, Y3, zs, IsCompressed); + return new SecP224K1Point(curve, X3, Y3, zs); } public override ECPoint Twice() @@ -228,7 +193,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec SecP224K1Field.Multiply(Z3.x, Z1.x, Z3.x); } - return new SecP224K1Point(curve, X3, Y3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecP224K1Point(curve, X3, Y3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -261,7 +226,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (IsInfinity) return this; - return new SecP224K1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords, IsCompressed); + return new SecP224K1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP224R1Curve.cs b/crypto/src/math/ec/custom/sec/SecP224R1Curve.cs index 8e79316d8..b82841446 100644 --- a/crypto/src/math/ec/custom/sec/SecP224R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP224R1Curve.cs @@ -68,14 +68,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecP224R1FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecP224R1Point(this, x, y, withCompression); + return new SecP224R1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecP224R1Point(this, x, y, zs, withCompression); + return new SecP224R1Point(this, x, y, zs); } public override ECLookupTable CreateCacheSafeLookupTable(ECPoint[] points, int off, int len) @@ -164,7 +164,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(uint[] x, uint[] y) { - return m_outer.CreateRawPoint(new SecP224R1FieldElement(x), new SecP224R1FieldElement(y), SECP224R1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecP224R1FieldElement(x), new SecP224R1FieldElement(y), SECP224R1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP224R1Point.cs b/crypto/src/math/ec/custom/sec/SecP224R1Point.cs index 73c4f1948..eda660d1f 100644 --- a/crypto/src/math/ec/custom/sec/SecP224R1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecP224R1Point.cs @@ -7,47 +7,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP224R1Point : AbstractFpPoint { - /** - * Create a point which encodes with point compression. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecP224R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecP224R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * Create a point that encodes with or without point compresion. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * @param withCompression - * if true encode with point compression - * - * @deprecated per-point compression property will be removed, refer - * {@link #getEncoded(bool)} - */ - public SecP224R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecP224R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecP224R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -172,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement[] zs = new ECFieldElement[] { Z3 }; - return new SecP224R1Point(curve, X3, Y3, zs, IsCompressed); + return new SecP224R1Point(curve, X3, Y3, zs); } public override ECPoint Twice() @@ -240,7 +206,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec SecP224R1Field.Multiply(Z3.x, Z1.x, Z3.x); } - return new SecP224R1Point(curve, X3, Y3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecP224R1Point(curve, X3, Y3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -273,7 +239,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (IsInfinity) return this; - return new SecP224R1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords, IsCompressed); + return new SecP224R1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP256K1Curve.cs b/crypto/src/math/ec/custom/sec/SecP256K1Curve.cs index 123305cd4..d9c876818 100644 --- a/crypto/src/math/ec/custom/sec/SecP256K1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP256K1Curve.cs @@ -65,14 +65,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecP256K1FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecP256K1Point(this, x, y, withCompression); + return new SecP256K1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecP256K1Point(this, x, y, zs, withCompression); + return new SecP256K1Point(this, x, y, zs); } public override ECLookupTable CreateCacheSafeLookupTable(ECPoint[] points, int off, int len) @@ -161,7 +161,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(uint[] x, uint[] y) { - return m_outer.CreateRawPoint(new SecP256K1FieldElement(x), new SecP256K1FieldElement(y), SECP256K1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecP256K1FieldElement(x), new SecP256K1FieldElement(y), SECP256K1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP256K1Point.cs b/crypto/src/math/ec/custom/sec/SecP256K1Point.cs index 689be0117..6b12fb41c 100644 --- a/crypto/src/math/ec/custom/sec/SecP256K1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecP256K1Point.cs @@ -7,48 +7,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP256K1Point : AbstractFpPoint { - /** - * Create a point which encodes with point compression. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecP256K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecP256K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * Create a point that encodes with or without point compresion. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * @param withCompression - * if true encode with point compression - * - * @deprecated per-point compression property will be removed, refer - * {@link #getEncoded(bool)} - */ - public SecP256K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecP256K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, - bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecP256K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -174,7 +139,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement[] zs = new ECFieldElement[] { Z3 }; - return new SecP256K1Point(curve, X3, Y3, zs, IsCompressed); + return new SecP256K1Point(curve, X3, Y3, zs); } public override ECPoint Twice() @@ -230,7 +195,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec SecP256K1Field.Multiply(Z3.x, Z1.x, Z3.x, tt0); } - return new SecP256K1Point(curve, X3, Y3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecP256K1Point(curve, X3, Y3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -263,7 +228,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (IsInfinity) return this; - return new SecP256K1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords, IsCompressed); + return new SecP256K1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP256R1Curve.cs b/crypto/src/math/ec/custom/sec/SecP256R1Curve.cs index b90f5d048..7a5cec8b3 100644 --- a/crypto/src/math/ec/custom/sec/SecP256R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP256R1Curve.cs @@ -67,14 +67,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecP256R1FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecP256R1Point(this, x, y, withCompression); + return new SecP256R1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecP256R1Point(this, x, y, zs, withCompression); + return new SecP256R1Point(this, x, y, zs); } public override ECLookupTable CreateCacheSafeLookupTable(ECPoint[] points, int off, int len) @@ -163,7 +163,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(uint[] x, uint[] y) { - return m_outer.CreateRawPoint(new SecP256R1FieldElement(x), new SecP256R1FieldElement(y), SECP256R1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecP256R1FieldElement(x), new SecP256R1FieldElement(y), SECP256R1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP256R1Point.cs b/crypto/src/math/ec/custom/sec/SecP256R1Point.cs index d487aad87..878937aff 100644 --- a/crypto/src/math/ec/custom/sec/SecP256R1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecP256R1Point.cs @@ -7,47 +7,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP256R1Point : AbstractFpPoint { - /** - * Create a point which encodes with point compression. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecP256R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecP256R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * Create a point that encodes with or without point compresion. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * @param withCompression - * if true encode with point compression - * - * @deprecated per-point compression property will be removed, refer - * {@link #getEncoded(bool)} - */ - public SecP256R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecP256R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecP256R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -173,7 +139,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement[] zs = new ECFieldElement[]{ Z3 }; - return new SecP256R1Point(curve, X3, Y3, zs, IsCompressed); + return new SecP256R1Point(curve, X3, Y3, zs); } public override ECPoint Twice() @@ -242,7 +208,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec SecP256R1Field.Multiply(Z3.x, Z1.x, Z3.x, tt0); } - return new SecP256R1Point(curve, X3, Y3, new ECFieldElement[]{ Z3 }, IsCompressed); + return new SecP256R1Point(curve, X3, Y3, new ECFieldElement[]{ Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -275,7 +241,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (IsInfinity) return this; - return new SecP256R1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords, IsCompressed); + return new SecP256R1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP384R1Curve.cs b/crypto/src/math/ec/custom/sec/SecP384R1Curve.cs index b57788ea0..242b73fc6 100644 --- a/crypto/src/math/ec/custom/sec/SecP384R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP384R1Curve.cs @@ -67,14 +67,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecP384R1FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecP384R1Point(this, x, y, withCompression); + return new SecP384R1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecP384R1Point(this, x, y, zs, withCompression); + return new SecP384R1Point(this, x, y, zs); } public override ECLookupTable CreateCacheSafeLookupTable(ECPoint[] points, int off, int len) @@ -163,7 +163,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(uint[] x, uint[] y) { - return m_outer.CreateRawPoint(new SecP384R1FieldElement(x), new SecP384R1FieldElement(y), SECP384R1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecP384R1FieldElement(x), new SecP384R1FieldElement(y), SECP384R1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP384R1Point.cs b/crypto/src/math/ec/custom/sec/SecP384R1Point.cs index c2c364be1..bbf509a6a 100644 --- a/crypto/src/math/ec/custom/sec/SecP384R1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecP384R1Point.cs @@ -7,47 +7,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP384R1Point : AbstractFpPoint { - /** - * Create a point which encodes with point compression. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecP384R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecP384R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * Create a point that encodes with or without point compresion. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * @param withCompression - * if true encode with point compression - * - * @deprecated per-point compression property will be removed, refer - * {@link #getEncoded(bool)} - */ - public SecP384R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecP384R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecP384R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -174,7 +140,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement[] zs = new ECFieldElement[] { Z3 }; - return new SecP384R1Point(curve, X3, Y3, zs, IsCompressed); + return new SecP384R1Point(curve, X3, Y3, zs); } public override ECPoint Twice() @@ -243,7 +209,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec SecP384R1Field.Multiply(Z3.x, Z1.x, Z3.x, tt0); } - return new SecP384R1Point(curve, X3, Y3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecP384R1Point(curve, X3, Y3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -276,7 +242,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (IsInfinity) return this; - return new SecP384R1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords, IsCompressed); + return new SecP384R1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP521R1Curve.cs b/crypto/src/math/ec/custom/sec/SecP521R1Curve.cs index 143176b10..9cdcec036 100644 --- a/crypto/src/math/ec/custom/sec/SecP521R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP521R1Curve.cs @@ -67,14 +67,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecP521R1FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecP521R1Point(this, x, y, withCompression); + return new SecP521R1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecP521R1Point(this, x, y, zs, withCompression); + return new SecP521R1Point(this, x, y, zs); } public override ECLookupTable CreateCacheSafeLookupTable(ECPoint[] points, int off, int len) @@ -163,7 +163,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(uint[] x, uint[] y) { - return m_outer.CreateRawPoint(new SecP521R1FieldElement(x), new SecP521R1FieldElement(y), SECP521R1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecP521R1FieldElement(x), new SecP521R1FieldElement(y), SECP521R1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecP521R1Point.cs b/crypto/src/math/ec/custom/sec/SecP521R1Point.cs index 7fc1927cf..f0ded2c8d 100644 --- a/crypto/src/math/ec/custom/sec/SecP521R1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecP521R1Point.cs @@ -7,47 +7,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP521R1Point : AbstractFpPoint { - /** - * Create a point which encodes with point compression. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecP521R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecP521R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * Create a point that encodes with or without point compresion. - * - * @param curve - * the curve to use - * @param x - * affine x co-ordinate - * @param y - * affine y co-ordinate - * @param withCompression - * if true encode with point compression - * - * @deprecated per-point compression property will be removed, refer - * {@link #getEncoded(bool)} - */ - public SecP521R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecP521R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecP521R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -170,7 +136,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement[] zs = new ECFieldElement[] { Z3 }; - return new SecP521R1Point(curve, X3, Y3, zs, IsCompressed); + return new SecP521R1Point(curve, X3, Y3, zs); } public override ECPoint Twice() @@ -238,7 +204,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec SecP521R1Field.Multiply(Z3.x, Z1.x, Z3.x, tt0); } - return new SecP521R1Point(curve, X3, Y3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecP521R1Point(curve, X3, Y3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -271,7 +237,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (IsInfinity) return this; - return new SecP521R1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords, IsCompressed); + return new SecP521R1Point(Curve, RawXCoord, RawYCoord.Negate(), RawZCoords); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT113R1Curve.cs b/crypto/src/math/ec/custom/sec/SecT113R1Curve.cs index 492b1d8b5..91cfc6ac0 100644 --- a/crypto/src/math/ec/custom/sec/SecT113R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecT113R1Curve.cs @@ -58,14 +58,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT113FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecT113R1Point(this, x, y, withCompression); + return new SecT113R1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecT113R1Point(this, x, y, zs, withCompression); + return new SecT113R1Point(this, x, y, zs); } public override bool IsKoblitz @@ -170,7 +170,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(ulong[] x, ulong[] y) { - return m_outer.CreateRawPoint(new SecT113FieldElement(x), new SecT113FieldElement(y), SECT113R1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecT113FieldElement(x), new SecT113FieldElement(y), SECT113R1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT113R1Point.cs b/crypto/src/math/ec/custom/sec/SecT113R1Point.cs index db085d005..551fd159c 100644 --- a/crypto/src/math/ec/custom/sec/SecT113R1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecT113R1Point.cs @@ -5,26 +5,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecT113R1Point : AbstractF2mPoint { - /** - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecT113R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecT113R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(bool)} - */ - public SecT113R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecT113R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecT113R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -134,7 +121,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = L.Square().Add(L).Add(X1).Add(curve.A); if (X3.IsZero) { - return new SecT113R1Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT113R1Point(curve, X3, curve.B.Sqrt()); } ECFieldElement Y3 = L.Multiply(X1.Add(X3)).Add(X3).Add(Y1); @@ -151,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = AU1.Multiply(AU2); if (X3.IsZero) { - return new SecT113R1Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT113R1Point(curve, X3, curve.B.Sqrt()); } ECFieldElement ABZ2 = A.Multiply(B); @@ -169,7 +156,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec } } - return new SecT113R1Point(curve, X3, L3, new ECFieldElement[]{ Z3 }, IsCompressed); + return new SecT113R1Point(curve, X3, L3, new ECFieldElement[]{ Z3 }); } public override ECPoint Twice() @@ -196,7 +183,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement T = L1.Square().Add(L1Z1).Add(aZ1Sq); if (T.IsZero) { - return new SecT113R1Point(curve, T, curve.B.Sqrt(), IsCompressed); + return new SecT113R1Point(curve, T, curve.B.Sqrt()); } ECFieldElement X3 = T.Square(); @@ -205,7 +192,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement X1Z1 = Z1IsOne ? X1 : X1.Multiply(Z1); ECFieldElement L3 = X1Z1.SquarePlusProduct(T, L1Z1).Add(X3).Add(Z3); - return new SecT113R1Point(curve, X3, L3, new ECFieldElement[]{ Z3 }, IsCompressed); + return new SecT113R1Point(curve, X3, L3, new ECFieldElement[]{ Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -254,14 +241,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (A.IsZero) { - return new SecT113R1Point(curve, A, curve.B.Sqrt(), IsCompressed); + return new SecT113R1Point(curve, A, curve.B.Sqrt()); } ECFieldElement X3 = A.Square().Multiply(X2Z1Sq); ECFieldElement Z3 = A.Multiply(B).Multiply(Z1Sq); ECFieldElement L3 = A.Add(B).Square().MultiplyPlusProduct(T, L2plus1, Z3); - return new SecT113R1Point(curve, X3, L3, new ECFieldElement[]{ Z3 }, IsCompressed); + return new SecT113R1Point(curve, X3, L3, new ECFieldElement[]{ Z3 }); } public override ECPoint Negate() @@ -275,7 +262,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec // L is actually Lambda (X + Y/X) here ECFieldElement L = this.RawYCoord, Z = this.RawZCoords[0]; - return new SecT113R1Point(Curve, X, L.Add(Z), new ECFieldElement[]{ Z }, IsCompressed); + return new SecT113R1Point(Curve, X, L.Add(Z), new ECFieldElement[]{ Z }); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT113R2Curve.cs b/crypto/src/math/ec/custom/sec/SecT113R2Curve.cs index d0fad0ff7..b11f2ad1b 100644 --- a/crypto/src/math/ec/custom/sec/SecT113R2Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecT113R2Curve.cs @@ -58,14 +58,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT113FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecT113R2Point(this, x, y, withCompression); + return new SecT113R2Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecT113R2Point(this, x, y, zs, withCompression); + return new SecT113R2Point(this, x, y, zs); } public override bool IsKoblitz @@ -170,7 +170,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(ulong[] x, ulong[] y) { - return m_outer.CreateRawPoint(new SecT113FieldElement(x), new SecT113FieldElement(y), SECT113R2_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecT113FieldElement(x), new SecT113FieldElement(y), SECT113R2_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT113R2Point.cs b/crypto/src/math/ec/custom/sec/SecT113R2Point.cs index 45fae2d95..d2c314a7e 100644 --- a/crypto/src/math/ec/custom/sec/SecT113R2Point.cs +++ b/crypto/src/math/ec/custom/sec/SecT113R2Point.cs @@ -5,26 +5,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecT113R2Point : AbstractF2mPoint { - /** - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecT113R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecT113R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(bool)} - */ - public SecT113R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecT113R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecT113R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -138,7 +125,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = L.Square().Add(L).Add(X1).Add(curve.A); if (X3.IsZero) { - return new SecT113R2Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT113R2Point(curve, X3, curve.B.Sqrt()); } ECFieldElement Y3 = L.Multiply(X1.Add(X3)).Add(X3).Add(Y1); @@ -155,7 +142,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = AU1.Multiply(AU2); if (X3.IsZero) { - return new SecT113R2Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT113R2Point(curve, X3, curve.B.Sqrt()); } ECFieldElement ABZ2 = A.Multiply(B); @@ -173,7 +160,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec } } - return new SecT113R2Point(curve, X3, L3, new ECFieldElement[]{ Z3 }, IsCompressed); + return new SecT113R2Point(curve, X3, L3, new ECFieldElement[]{ Z3 }); } public override ECPoint Twice() @@ -202,7 +189,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement T = L1.Square().Add(L1Z1).Add(aZ1Sq); if (T.IsZero) { - return new SecT113R2Point(curve, T, curve.B.Sqrt(), IsCompressed); + return new SecT113R2Point(curve, T, curve.B.Sqrt()); } ECFieldElement X3 = T.Square(); @@ -211,7 +198,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement X1Z1 = Z1IsOne ? X1 : X1.Multiply(Z1); ECFieldElement L3 = X1Z1.SquarePlusProduct(T, L1Z1).Add(X3).Add(Z3); - return new SecT113R2Point(curve, X3, L3, new ECFieldElement[]{ Z3 }, IsCompressed); + return new SecT113R2Point(curve, X3, L3, new ECFieldElement[]{ Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -264,14 +251,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (A.IsZero) { - return new SecT113R2Point(curve, A, curve.B.Sqrt(), IsCompressed); + return new SecT113R2Point(curve, A, curve.B.Sqrt()); } ECFieldElement X3 = A.Square().Multiply(X2Z1Sq); ECFieldElement Z3 = A.Multiply(B).Multiply(Z1Sq); ECFieldElement L3 = A.Add(B).Square().MultiplyPlusProduct(T, L2plus1, Z3); - return new SecT113R2Point(curve, X3, L3, new ECFieldElement[]{ Z3 }, IsCompressed); + return new SecT113R2Point(curve, X3, L3, new ECFieldElement[]{ Z3 }); } public override ECPoint Negate() @@ -285,7 +272,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec // L is actually Lambda (X + Y/X) here ECFieldElement L = this.RawYCoord, Z = this.RawZCoords[0]; - return new SecT113R2Point(Curve, X, L.Add(Z), new ECFieldElement[]{ Z }, IsCompressed); + return new SecT113R2Point(Curve, X, L.Add(Z), new ECFieldElement[]{ Z }); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT131R1Curve.cs b/crypto/src/math/ec/custom/sec/SecT131R1Curve.cs index 2b2636901..9e6e81bf0 100644 --- a/crypto/src/math/ec/custom/sec/SecT131R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecT131R1Curve.cs @@ -58,14 +58,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT131FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecT131R1Point(this, x, y, withCompression); + return new SecT131R1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecT131R1Point(this, x, y, zs, withCompression); + return new SecT131R1Point(this, x, y, zs); } public override bool IsKoblitz @@ -170,7 +170,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(ulong[] x, ulong[] y) { - return m_outer.CreateRawPoint(new SecT131FieldElement(x), new SecT131FieldElement(y), SECT131R1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecT131FieldElement(x), new SecT131FieldElement(y), SECT131R1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT131R1Point.cs b/crypto/src/math/ec/custom/sec/SecT131R1Point.cs index 7aba4f2e0..22102ba6c 100644 --- a/crypto/src/math/ec/custom/sec/SecT131R1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecT131R1Point.cs @@ -5,26 +5,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecT131R1Point : AbstractF2mPoint { - /** - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecT131R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecT131R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(bool)} - */ - public SecT131R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecT131R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecT131R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -134,7 +121,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = L.Square().Add(L).Add(X1).Add(curve.A); if (X3.IsZero) { - return new SecT131R1Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT131R1Point(curve, X3, curve.B.Sqrt()); } ECFieldElement Y3 = L.Multiply(X1.Add(X3)).Add(X3).Add(Y1); @@ -151,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = AU1.Multiply(AU2); if (X3.IsZero) { - return new SecT131R1Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT131R1Point(curve, X3, curve.B.Sqrt()); } ECFieldElement ABZ2 = A.Multiply(B); @@ -169,7 +156,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec } } - return new SecT131R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT131R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Twice() @@ -198,7 +185,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement T = L1.Square().Add(L1Z1).Add(aZ1Sq); if (T.IsZero) { - return new SecT131R1Point(curve, T, curve.B.Sqrt(), IsCompressed); + return new SecT131R1Point(curve, T, curve.B.Sqrt()); } ECFieldElement X3 = T.Square(); @@ -207,7 +194,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement X1Z1 = Z1IsOne ? X1 : X1.Multiply(Z1); ECFieldElement L3 = X1Z1.SquarePlusProduct(T, L1Z1).Add(X3).Add(Z3); - return new SecT131R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT131R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -260,14 +247,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (A.IsZero) { - return new SecT131R1Point(curve, A, curve.B.Sqrt(), IsCompressed); + return new SecT131R1Point(curve, A, curve.B.Sqrt()); } ECFieldElement X3 = A.Square().Multiply(X2Z1Sq); ECFieldElement Z3 = A.Multiply(B).Multiply(Z1Sq); ECFieldElement L3 = A.Add(B).Square().MultiplyPlusProduct(T, L2plus1, Z3); - return new SecT131R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT131R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Negate() @@ -281,7 +268,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec // L is actually Lambda (X + Y/X) here ECFieldElement L = this.RawYCoord, Z = this.RawZCoords[0]; - return new SecT131R1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }, IsCompressed); + return new SecT131R1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT131R2Curve.cs b/crypto/src/math/ec/custom/sec/SecT131R2Curve.cs index 123362f4d..8851c8d1c 100644 --- a/crypto/src/math/ec/custom/sec/SecT131R2Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecT131R2Curve.cs @@ -53,14 +53,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT131FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecT131R2Point(this, x, y, withCompression); + return new SecT131R2Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecT131R2Point(this, x, y, zs, withCompression); + return new SecT131R2Point(this, x, y, zs); } public override ECPoint Infinity @@ -170,7 +170,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(ulong[] x, ulong[] y) { - return m_outer.CreateRawPoint(new SecT131FieldElement(x), new SecT131FieldElement(y), SECT131R2_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecT131FieldElement(x), new SecT131FieldElement(y), SECT131R2_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT131R2Point.cs b/crypto/src/math/ec/custom/sec/SecT131R2Point.cs index 5d06049bc..9600371c1 100644 --- a/crypto/src/math/ec/custom/sec/SecT131R2Point.cs +++ b/crypto/src/math/ec/custom/sec/SecT131R2Point.cs @@ -5,26 +5,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecT131R2Point : AbstractF2mPoint { - /** - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecT131R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecT131R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(bool)} - */ - public SecT131R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecT131R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecT131R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -134,7 +121,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = L.Square().Add(L).Add(X1).Add(curve.A); if (X3.IsZero) { - return new SecT131R2Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT131R2Point(curve, X3, curve.B.Sqrt()); } ECFieldElement Y3 = L.Multiply(X1.Add(X3)).Add(X3).Add(Y1); @@ -151,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = AU1.Multiply(AU2); if (X3.IsZero) { - return new SecT131R2Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT131R2Point(curve, X3, curve.B.Sqrt()); } ECFieldElement ABZ2 = A.Multiply(B); @@ -169,7 +156,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec } } - return new SecT131R2Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT131R2Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Twice() @@ -198,7 +185,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement T = L1.Square().Add(L1Z1).Add(aZ1Sq); if (T.IsZero) { - return new SecT131R2Point(curve, T, curve.B.Sqrt(), IsCompressed); + return new SecT131R2Point(curve, T, curve.B.Sqrt()); } ECFieldElement X3 = T.Square(); @@ -207,7 +194,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement X1Z1 = Z1IsOne ? X1 : X1.Multiply(Z1); ECFieldElement L3 = X1Z1.SquarePlusProduct(T, L1Z1).Add(X3).Add(Z3); - return new SecT131R2Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT131R2Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -256,14 +243,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (A.IsZero) { - return new SecT131R2Point(curve, A, curve.B.Sqrt(), IsCompressed); + return new SecT131R2Point(curve, A, curve.B.Sqrt()); } ECFieldElement X3 = A.Square().Multiply(X2Z1Sq); ECFieldElement Z3 = A.Multiply(B).Multiply(Z1Sq); ECFieldElement L3 = A.Add(B).Square().MultiplyPlusProduct(T, L2plus1, Z3); - return new SecT131R2Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT131R2Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Negate() @@ -277,7 +264,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec // L is actually Lambda (X + Y/X) here ECFieldElement L = this.RawYCoord, Z = this.RawZCoords[0]; - return new SecT131R2Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }, IsCompressed); + return new SecT131R2Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT163K1Curve.cs b/crypto/src/math/ec/custom/sec/SecT163K1Curve.cs index 31c63a8c4..2c3e67820 100644 --- a/crypto/src/math/ec/custom/sec/SecT163K1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecT163K1Curve.cs @@ -64,14 +64,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT163FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecT163K1Point(this, x, y, withCompression); + return new SecT163K1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecT163K1Point(this, x, y, zs, withCompression); + return new SecT163K1Point(this, x, y, zs); } public override bool IsKoblitz @@ -176,7 +176,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(ulong[] x, ulong[] y) { - return m_outer.CreateRawPoint(new SecT163FieldElement(x), new SecT163FieldElement(y), SECT163K1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecT163FieldElement(x), new SecT163FieldElement(y), SECT163K1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT163K1Point.cs b/crypto/src/math/ec/custom/sec/SecT163K1Point.cs index 66e657cc6..0a96f04eb 100644 --- a/crypto/src/math/ec/custom/sec/SecT163K1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecT163K1Point.cs @@ -5,26 +5,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecT163K1Point : AbstractF2mPoint { - /** - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecT163K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecT163K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(bool)} - */ - public SecT163K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecT163K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecT163K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -134,7 +121,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = L.Square().Add(L).Add(X1).AddOne(); if (X3.IsZero) { - return new SecT163K1Point(curve, X3, curve.B, IsCompressed); + return new SecT163K1Point(curve, X3, curve.B); } ECFieldElement Y3 = L.Multiply(X1.Add(X3)).Add(X3).Add(Y1); @@ -151,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = AU1.Multiply(AU2); if (X3.IsZero) { - return new SecT163K1Point(curve, X3, curve.B, IsCompressed); + return new SecT163K1Point(curve, X3, curve.B); } ECFieldElement ABZ2 = A.Multiply(B); @@ -169,7 +156,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec } } - return new SecT163K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT163K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Twice() @@ -196,7 +183,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement T = L1.Square().Add(L1Z1).Add(Z1Sq); if (T.IsZero) { - return new SecT163K1Point(curve, T, curve.B, IsCompressed); + return new SecT163K1Point(curve, T, curve.B); } ECFieldElement X3 = T.Square(); @@ -205,7 +192,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement t1 = L1.Add(X1).Square(); ECFieldElement L3 = t1.Add(T).Add(Z1Sq).Multiply(t1).Add(X3); - return new SecT163K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT163K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -254,14 +241,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (A.IsZero) { - return new SecT163K1Point(curve, A, curve.B, IsCompressed); + return new SecT163K1Point(curve, A, curve.B); } ECFieldElement X3 = A.Square().Multiply(X2Z1Sq); ECFieldElement Z3 = A.Multiply(B).Multiply(Z1Sq); ECFieldElement L3 = A.Add(B).Square().MultiplyPlusProduct(T, L2.AddOne(), Z3); - return new SecT163K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT163K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Negate() @@ -275,7 +262,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec // L is actually Lambda (X + Y/X) here ECFieldElement L = this.RawYCoord, Z = this.RawZCoords[0]; - return new SecT163K1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }, IsCompressed); + return new SecT163K1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT163R1Curve.cs b/crypto/src/math/ec/custom/sec/SecT163R1Curve.cs index 61c452ea7..e7c395191 100644 --- a/crypto/src/math/ec/custom/sec/SecT163R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecT163R1Curve.cs @@ -58,14 +58,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT163FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecT163R1Point(this, x, y, withCompression); + return new SecT163R1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecT163R1Point(this, x, y, zs, withCompression); + return new SecT163R1Point(this, x, y, zs); } public override bool IsKoblitz @@ -170,7 +170,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(ulong[] x, ulong[] y) { - return m_outer.CreateRawPoint(new SecT163FieldElement(x), new SecT163FieldElement(y), SECT163R1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecT163FieldElement(x), new SecT163FieldElement(y), SECT163R1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT163R1Point.cs b/crypto/src/math/ec/custom/sec/SecT163R1Point.cs index bab1f3529..52cbf32ef 100644 --- a/crypto/src/math/ec/custom/sec/SecT163R1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecT163R1Point.cs @@ -5,26 +5,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecT163R1Point : AbstractF2mPoint { - /** - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecT163R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecT163R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(bool)} - */ - public SecT163R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecT163R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecT163R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -134,7 +121,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = L.Square().Add(L).Add(X1).Add(curve.A); if (X3.IsZero) { - return new SecT163R1Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT163R1Point(curve, X3, curve.B.Sqrt()); } ECFieldElement Y3 = L.Multiply(X1.Add(X3)).Add(X3).Add(Y1); @@ -151,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = AU1.Multiply(AU2); if (X3.IsZero) { - return new SecT163R1Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT163R1Point(curve, X3, curve.B.Sqrt()); } ECFieldElement ABZ2 = A.Multiply(B); @@ -169,7 +156,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec } } - return new SecT163R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT163R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Twice() @@ -198,7 +185,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement T = L1.Square().Add(L1Z1).Add(aZ1Sq); if (T.IsZero) { - return new SecT163R1Point(curve, T, curve.B.Sqrt(), IsCompressed); + return new SecT163R1Point(curve, T, curve.B.Sqrt()); } ECFieldElement X3 = T.Square(); @@ -207,7 +194,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement X1Z1 = Z1IsOne ? X1 : X1.Multiply(Z1); ECFieldElement L3 = X1Z1.SquarePlusProduct(T, L1Z1).Add(X3).Add(Z3); - return new SecT163R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT163R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -256,14 +243,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (A.IsZero) { - return new SecT163R1Point(curve, A, curve.B.Sqrt(), IsCompressed); + return new SecT163R1Point(curve, A, curve.B.Sqrt()); } ECFieldElement X3 = A.Square().Multiply(X2Z1Sq); ECFieldElement Z3 = A.Multiply(B).Multiply(Z1Sq); ECFieldElement L3 = A.Add(B).Square().MultiplyPlusProduct(T, L2plus1, Z3); - return new SecT163R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT163R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Negate() @@ -277,7 +264,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec // L is actually Lambda (X + Y/X) here ECFieldElement L = this.RawYCoord, Z = this.RawZCoords[0]; - return new SecT163R1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }, IsCompressed); + return new SecT163R1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT163R2Curve.cs b/crypto/src/math/ec/custom/sec/SecT163R2Curve.cs index c610b5722..05ca7007a 100644 --- a/crypto/src/math/ec/custom/sec/SecT163R2Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecT163R2Curve.cs @@ -58,14 +58,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT163FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecT163R2Point(this, x, y, withCompression); + return new SecT163R2Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecT163R2Point(this, x, y, zs, withCompression); + return new SecT163R2Point(this, x, y, zs); } public override bool IsKoblitz @@ -170,7 +170,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(ulong[] x, ulong[] y) { - return m_outer.CreateRawPoint(new SecT163FieldElement(x), new SecT163FieldElement(y), SECT163R2_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecT163FieldElement(x), new SecT163FieldElement(y), SECT163R2_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT163R2Point.cs b/crypto/src/math/ec/custom/sec/SecT163R2Point.cs index a207e6fba..40f35a93b 100644 --- a/crypto/src/math/ec/custom/sec/SecT163R2Point.cs +++ b/crypto/src/math/ec/custom/sec/SecT163R2Point.cs @@ -5,26 +5,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecT163R2Point : AbstractF2mPoint { - /** - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecT163R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecT163R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(bool)} - */ - public SecT163R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecT163R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecT163R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -136,7 +123,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = L.Square().Add(L).Add(X1).AddOne(); if (X3.IsZero) { - return new SecT163R2Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT163R2Point(curve, X3, curve.B.Sqrt()); } ECFieldElement Y3 = L.Multiply(X1.Add(X3)).Add(X3).Add(Y1); @@ -153,7 +140,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = AU1.Multiply(AU2); if (X3.IsZero) { - return new SecT163R2Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT163R2Point(curve, X3, curve.B.Sqrt()); } ECFieldElement ABZ2 = A.Multiply(B); @@ -171,7 +158,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec } } - return new SecT163R2Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT163R2Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Twice() @@ -198,7 +185,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement T = L1.Square().Add(L1Z1).Add(Z1Sq); if (T.IsZero) { - return new SecT163R2Point(curve, T, curve.B.Sqrt(), IsCompressed); + return new SecT163R2Point(curve, T, curve.B.Sqrt()); } ECFieldElement X3 = T.Square(); @@ -207,7 +194,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement X1Z1 = Z1IsOne ? X1 : X1.Multiply(Z1); ECFieldElement L3 = X1Z1.SquarePlusProduct(T, L1Z1).Add(X3).Add(Z3); - return new SecT163R2Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT163R2Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -259,14 +246,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (A.IsZero) { - return new SecT163R2Point(curve, A, curve.B.Sqrt(), IsCompressed); + return new SecT163R2Point(curve, A, curve.B.Sqrt()); } ECFieldElement X3 = A.Square().Multiply(X2Z1Sq); ECFieldElement Z3 = A.Multiply(B).Multiply(Z1Sq); ECFieldElement L3 = A.Add(B).Square().MultiplyPlusProduct(T, L2.AddOne(), Z3); - return new SecT163R2Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT163R2Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Negate() @@ -280,7 +267,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec // L is actually Lambda (X + Y/X) here ECFieldElement L = this.RawYCoord, Z = this.RawZCoords[0]; - return new SecT163R2Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }, IsCompressed); + return new SecT163R2Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT193R1Curve.cs b/crypto/src/math/ec/custom/sec/SecT193R1Curve.cs index 32bc434c7..44c3593d8 100644 --- a/crypto/src/math/ec/custom/sec/SecT193R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecT193R1Curve.cs @@ -58,14 +58,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT193FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecT193R1Point(this, x, y, withCompression); + return new SecT193R1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecT193R1Point(this, x, y, zs, withCompression); + return new SecT193R1Point(this, x, y, zs); } public override bool IsKoblitz @@ -170,7 +170,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(ulong[] x, ulong[] y) { - return m_outer.CreateRawPoint(new SecT193FieldElement(x), new SecT193FieldElement(y), SECT193R1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecT193FieldElement(x), new SecT193FieldElement(y), SECT193R1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT193R1Point.cs b/crypto/src/math/ec/custom/sec/SecT193R1Point.cs index 9dbdd14c2..b4b798aff 100644 --- a/crypto/src/math/ec/custom/sec/SecT193R1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecT193R1Point.cs @@ -5,26 +5,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecT193R1Point : AbstractF2mPoint { - /** - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecT193R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecT193R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(bool)} - */ - public SecT193R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecT193R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecT193R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -134,7 +121,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = L.Square().Add(L).Add(X1).Add(curve.A); if (X3.IsZero) { - return new SecT193R1Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT193R1Point(curve, X3, curve.B.Sqrt()); } ECFieldElement Y3 = L.Multiply(X1.Add(X3)).Add(X3).Add(Y1); @@ -151,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = AU1.Multiply(AU2); if (X3.IsZero) { - return new SecT193R1Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT193R1Point(curve, X3, curve.B.Sqrt()); } ECFieldElement ABZ2 = A.Multiply(B); @@ -169,7 +156,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec } } - return new SecT193R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT193R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Twice() @@ -198,7 +185,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement T = L1.Square().Add(L1Z1).Add(aZ1Sq); if (T.IsZero) { - return new SecT193R1Point(curve, T, curve.B.Sqrt(), IsCompressed); + return new SecT193R1Point(curve, T, curve.B.Sqrt()); } ECFieldElement X3 = T.Square(); @@ -207,7 +194,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement X1Z1 = Z1IsOne ? X1 : X1.Multiply(Z1); ECFieldElement L3 = X1Z1.SquarePlusProduct(T, L1Z1).Add(X3).Add(Z3); - return new SecT193R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT193R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -256,14 +243,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (A.IsZero) { - return new SecT193R1Point(curve, A, curve.B.Sqrt(), IsCompressed); + return new SecT193R1Point(curve, A, curve.B.Sqrt()); } ECFieldElement X3 = A.Square().Multiply(X2Z1Sq); ECFieldElement Z3 = A.Multiply(B).Multiply(Z1Sq); ECFieldElement L3 = A.Add(B).Square().MultiplyPlusProduct(T, L2plus1, Z3); - return new SecT193R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT193R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Negate() @@ -277,7 +264,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec // L is actually Lambda (X + Y/X) here ECFieldElement L = this.RawYCoord, Z = this.RawZCoords[0]; - return new SecT193R1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }, IsCompressed); + return new SecT193R1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT193R2Curve.cs b/crypto/src/math/ec/custom/sec/SecT193R2Curve.cs index 7f5357177..9ff71fccf 100644 --- a/crypto/src/math/ec/custom/sec/SecT193R2Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecT193R2Curve.cs @@ -58,14 +58,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT193FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecT193R2Point(this, x, y, withCompression); + return new SecT193R2Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecT193R2Point(this, x, y, zs, withCompression); + return new SecT193R2Point(this, x, y, zs); } public override bool IsKoblitz @@ -170,7 +170,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(ulong[] x, ulong[] y) { - return m_outer.CreateRawPoint(new SecT193FieldElement(x), new SecT193FieldElement(y), SECT193R2_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecT193FieldElement(x), new SecT193FieldElement(y), SECT193R2_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT193R2Point.cs b/crypto/src/math/ec/custom/sec/SecT193R2Point.cs index b75a7ce58..782a08dfa 100644 --- a/crypto/src/math/ec/custom/sec/SecT193R2Point.cs +++ b/crypto/src/math/ec/custom/sec/SecT193R2Point.cs @@ -5,26 +5,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecT193R2Point : AbstractF2mPoint { - /** - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecT193R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecT193R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(bool)} - */ - public SecT193R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecT193R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecT193R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -134,7 +121,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = L.Square().Add(L).Add(X1).Add(curve.A); if (X3.IsZero) { - return new SecT193R2Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT193R2Point(curve, X3, curve.B.Sqrt()); } ECFieldElement Y3 = L.Multiply(X1.Add(X3)).Add(X3).Add(Y1); @@ -151,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = AU1.Multiply(AU2); if (X3.IsZero) { - return new SecT193R2Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT193R2Point(curve, X3, curve.B.Sqrt()); } ECFieldElement ABZ2 = A.Multiply(B); @@ -169,7 +156,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec } } - return new SecT193R2Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT193R2Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Twice() @@ -198,7 +185,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement T = L1.Square().Add(L1Z1).Add(aZ1Sq); if (T.IsZero) { - return new SecT193R2Point(curve, T, curve.B.Sqrt(), IsCompressed); + return new SecT193R2Point(curve, T, curve.B.Sqrt()); } ECFieldElement X3 = T.Square(); @@ -207,7 +194,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement X1Z1 = Z1IsOne ? X1 : X1.Multiply(Z1); ECFieldElement L3 = X1Z1.SquarePlusProduct(T, L1Z1).Add(X3).Add(Z3); - return new SecT193R2Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT193R2Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -256,14 +243,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (A.IsZero) { - return new SecT193R2Point(curve, A, curve.B.Sqrt(), IsCompressed); + return new SecT193R2Point(curve, A, curve.B.Sqrt()); } ECFieldElement X3 = A.Square().Multiply(X2Z1Sq); ECFieldElement Z3 = A.Multiply(B).Multiply(Z1Sq); ECFieldElement L3 = A.Add(B).Square().MultiplyPlusProduct(T, L2plus1, Z3); - return new SecT193R2Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT193R2Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Negate() @@ -277,7 +264,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec // L is actually Lambda (X + Y/X) here ECFieldElement L = this.RawYCoord, Z = this.RawZCoords[0]; - return new SecT193R2Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }, IsCompressed); + return new SecT193R2Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT233K1Curve.cs b/crypto/src/math/ec/custom/sec/SecT233K1Curve.cs index 7a3f55f87..512c87d70 100644 --- a/crypto/src/math/ec/custom/sec/SecT233K1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecT233K1Curve.cs @@ -59,14 +59,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT233FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecT233K1Point(this, x, y, withCompression); + return new SecT233K1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecT233K1Point(this, x, y, zs, withCompression); + return new SecT233K1Point(this, x, y, zs); } public override ECPoint Infinity @@ -176,7 +176,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(ulong[] x, ulong[] y) { - return m_outer.CreateRawPoint(new SecT233FieldElement(x), new SecT233FieldElement(y), SECT233K1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecT233FieldElement(x), new SecT233FieldElement(y), SECT233K1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT233K1Point.cs b/crypto/src/math/ec/custom/sec/SecT233K1Point.cs index ffb865591..53053a144 100644 --- a/crypto/src/math/ec/custom/sec/SecT233K1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecT233K1Point.cs @@ -5,32 +5,19 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecT233K1Point : AbstractF2mPoint { - /** - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecT233K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecT233K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(bool)} - */ - public SecT233K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecT233K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecT233K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } protected override ECPoint Detach() { - return new SecT233K1Point(null, this.AffineXCoord, this.AffineYCoord); // earlier JDK + return new SecT233K1Point(null, this.AffineXCoord, this.AffineYCoord); } public override ECFieldElement YCoord @@ -136,7 +123,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = L.Square().Add(L).Add(X1); if (X3.IsZero) { - return new SecT233K1Point(curve, X3, curve.B, IsCompressed); + return new SecT233K1Point(curve, X3, curve.B); } ECFieldElement Y3 = L.Multiply(X1.Add(X3)).Add(X3).Add(Y1); @@ -153,7 +140,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = AU1.Multiply(AU2); if (X3.IsZero) { - return new SecT233K1Point(curve, X3, curve.B, IsCompressed); + return new SecT233K1Point(curve, X3, curve.B); } ECFieldElement ABZ2 = A.Multiply(B); @@ -171,7 +158,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec } } - return new SecT233K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT233K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Twice() @@ -206,7 +193,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (T.IsZero) { - return new SecT233K1Point(curve, T, curve.B, IsCompressed); + return new SecT233K1Point(curve, T, curve.B); } ECFieldElement X3 = T.Square(); @@ -216,7 +203,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement t2 = Z1IsOne ? Z1 : Z1Sq.Square(); ECFieldElement L3 = t1.Add(T).Add(Z1Sq).Multiply(t1).Add(t2).Add(X3).Add(Z3); - return new SecT233K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT233K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -268,14 +255,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (A.IsZero) { - return new SecT233K1Point(curve, A, curve.B, IsCompressed); + return new SecT233K1Point(curve, A, curve.B); } ECFieldElement X3 = A.Square().Multiply(X2Z1Sq); ECFieldElement Z3 = A.Multiply(B).Multiply(Z1Sq); ECFieldElement L3 = A.Add(B).Square().MultiplyPlusProduct(T, L2plus1, Z3); - return new SecT233K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT233K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Negate() @@ -289,7 +276,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec // L is actually Lambda (X + Y/X) here ECFieldElement L = this.RawYCoord, Z = this.RawZCoords[0]; - return new SecT233K1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }, IsCompressed); + return new SecT233K1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT233R1Curve.cs b/crypto/src/math/ec/custom/sec/SecT233R1Curve.cs index 7b7e59386..2487d5248 100644 --- a/crypto/src/math/ec/custom/sec/SecT233R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecT233R1Curve.cs @@ -58,14 +58,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT233FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecT233R1Point(this, x, y, withCompression); + return new SecT233R1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecT233R1Point(this, x, y, zs, withCompression); + return new SecT233R1Point(this, x, y, zs); } public override bool IsKoblitz @@ -170,7 +170,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(ulong[] x, ulong[] y) { - return m_outer.CreateRawPoint(new SecT233FieldElement(x), new SecT233FieldElement(y), SECT233R1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecT233FieldElement(x), new SecT233FieldElement(y), SECT233R1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT233R1Point.cs b/crypto/src/math/ec/custom/sec/SecT233R1Point.cs index b9c6ce62a..59587f0f3 100644 --- a/crypto/src/math/ec/custom/sec/SecT233R1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecT233R1Point.cs @@ -5,26 +5,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecT233R1Point : AbstractF2mPoint { - /** - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecT233R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecT233R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(bool)} - */ - public SecT233R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecT233R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecT233R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -134,7 +121,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = L.Square().Add(L).Add(X1).AddOne(); if (X3.IsZero) { - return new SecT233R1Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT233R1Point(curve, X3, curve.B.Sqrt()); } ECFieldElement Y3 = L.Multiply(X1.Add(X3)).Add(X3).Add(Y1); @@ -151,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = AU1.Multiply(AU2); if (X3.IsZero) { - return new SecT233R1Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT233R1Point(curve, X3, curve.B.Sqrt()); } ECFieldElement ABZ2 = A.Multiply(B); @@ -169,7 +156,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec } } - return new SecT233R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT233R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Twice() @@ -194,7 +181,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement T = L1.Square().Add(L1Z1).Add(Z1Sq); if (T.IsZero) { - return new SecT233R1Point(curve, T, curve.B.Sqrt(), IsCompressed); + return new SecT233R1Point(curve, T, curve.B.Sqrt()); } ECFieldElement X3 = T.Square(); @@ -203,7 +190,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement X1Z1 = Z1IsOne ? X1 : X1.Multiply(Z1); ECFieldElement L3 = X1Z1.SquarePlusProduct(T, L1Z1).Add(X3).Add(Z3); - return new SecT233R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT233R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -251,14 +238,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (A.IsZero) { - return new SecT233R1Point(curve, A, curve.B.Sqrt(), IsCompressed); + return new SecT233R1Point(curve, A, curve.B.Sqrt()); } ECFieldElement X3 = A.Square().Multiply(X2Z1Sq); ECFieldElement Z3 = A.Multiply(B).Multiply(Z1Sq); ECFieldElement L3 = A.Add(B).Square().MultiplyPlusProduct(T, L2.AddOne(), Z3); - return new SecT233R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT233R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Negate() @@ -272,7 +259,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec // L is actually Lambda (X + Y/X) here ECFieldElement L = this.RawYCoord, Z = this.RawZCoords[0]; - return new SecT233R1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }, IsCompressed); + return new SecT233R1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT239K1Curve.cs b/crypto/src/math/ec/custom/sec/SecT239K1Curve.cs index 48854ce7e..c84962b17 100644 --- a/crypto/src/math/ec/custom/sec/SecT239K1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecT239K1Curve.cs @@ -64,14 +64,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT239FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecT239K1Point(this, x, y, withCompression); + return new SecT239K1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecT239K1Point(this, x, y, zs, withCompression); + return new SecT239K1Point(this, x, y, zs); } public override bool IsKoblitz @@ -176,7 +176,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(ulong[] x, ulong[] y) { - return m_outer.CreateRawPoint(new SecT239FieldElement(x), new SecT239FieldElement(y), SECT239K1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecT239FieldElement(x), new SecT239FieldElement(y), SECT239K1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT239K1Point.cs b/crypto/src/math/ec/custom/sec/SecT239K1Point.cs index 36b4606d1..b49563a98 100644 --- a/crypto/src/math/ec/custom/sec/SecT239K1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecT239K1Point.cs @@ -5,32 +5,19 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecT239K1Point : AbstractF2mPoint { - /** - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecT239K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecT239K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(bool)} - */ - public SecT239K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecT239K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecT239K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } protected override ECPoint Detach() { - return new SecT239K1Point(null, this.AffineXCoord, this.AffineYCoord); // earlier JDK + return new SecT239K1Point(null, this.AffineXCoord, this.AffineYCoord); } public override ECFieldElement YCoord @@ -134,7 +121,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = L.Square().Add(L).Add(X1); if (X3.IsZero) { - return new SecT239K1Point(curve, X3, curve.B, IsCompressed); + return new SecT239K1Point(curve, X3, curve.B); } ECFieldElement Y3 = L.Multiply(X1.Add(X3)).Add(X3).Add(Y1); @@ -151,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = AU1.Multiply(AU2); if (X3.IsZero) { - return new SecT239K1Point(curve, X3, curve.B, IsCompressed); + return new SecT239K1Point(curve, X3, curve.B); } ECFieldElement ABZ2 = A.Multiply(B); @@ -169,7 +156,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec } } - return new SecT239K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT239K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Twice() @@ -203,7 +190,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (T.IsZero) { - return new SecT239K1Point(curve, T, curve.B, IsCompressed); + return new SecT239K1Point(curve, T, curve.B); } ECFieldElement X3 = T.Square(); @@ -213,7 +200,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement t2 = Z1IsOne ? Z1 : Z1Sq.Square(); ECFieldElement L3 = t1.Add(T).Add(Z1Sq).Multiply(t1).Add(t2).Add(X3).Add(Z3); - return new SecT239K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT239K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -263,14 +250,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (A.IsZero) { - return new SecT239K1Point(curve, A, curve.B, IsCompressed); + return new SecT239K1Point(curve, A, curve.B); } ECFieldElement X3 = A.Square().Multiply(X2Z1Sq); ECFieldElement Z3 = A.Multiply(B).Multiply(Z1Sq); ECFieldElement L3 = A.Add(B).Square().MultiplyPlusProduct(T, L2plus1, Z3); - return new SecT239K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT239K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Negate() @@ -284,7 +271,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec // L is actually Lambda (X + Y/X) here ECFieldElement L = this.RawYCoord, Z = this.RawZCoords[0]; - return new SecT239K1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }, IsCompressed); + return new SecT239K1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT283K1Curve.cs b/crypto/src/math/ec/custom/sec/SecT283K1Curve.cs index c4d182435..462b5c9f2 100644 --- a/crypto/src/math/ec/custom/sec/SecT283K1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecT283K1Curve.cs @@ -64,14 +64,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT283FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecT283K1Point(this, x, y, withCompression); + return new SecT283K1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecT283K1Point(this, x, y, zs, withCompression); + return new SecT283K1Point(this, x, y, zs); } public override bool IsKoblitz @@ -176,7 +176,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(ulong[] x, ulong[] y) { - return m_outer.CreateRawPoint(new SecT283FieldElement(x), new SecT283FieldElement(y), SECT283K1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecT283FieldElement(x), new SecT283FieldElement(y), SECT283K1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT283K1Point.cs b/crypto/src/math/ec/custom/sec/SecT283K1Point.cs index d3d7fa107..e5888daca 100644 --- a/crypto/src/math/ec/custom/sec/SecT283K1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecT283K1Point.cs @@ -5,32 +5,19 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecT283K1Point : AbstractF2mPoint { - /** - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecT283K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecT283K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(bool)} - */ - public SecT283K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecT283K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecT283K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } protected override ECPoint Detach() { - return new SecT283K1Point(null, this.AffineXCoord, this.AffineYCoord); // earlier JDK + return new SecT283K1Point(null, this.AffineXCoord, this.AffineYCoord); } public override ECFieldElement YCoord @@ -134,7 +121,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = L.Square().Add(L).Add(X1); if (X3.IsZero) { - return new SecT283K1Point(curve, X3, curve.B, IsCompressed); + return new SecT283K1Point(curve, X3, curve.B); } ECFieldElement Y3 = L.Multiply(X1.Add(X3)).Add(X3).Add(Y1); @@ -151,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = AU1.Multiply(AU2); if (X3.IsZero) { - return new SecT283K1Point(curve, X3, curve.B, IsCompressed); + return new SecT283K1Point(curve, X3, curve.B); } ECFieldElement ABZ2 = A.Multiply(B); @@ -169,7 +156,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec } } - return new SecT283K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT283K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Twice() @@ -202,7 +189,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (T.IsZero) { - return new SecT283K1Point(curve, T, curve.B, IsCompressed); + return new SecT283K1Point(curve, T, curve.B); } ECFieldElement X3 = T.Square(); @@ -212,7 +199,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement t2 = Z1IsOne ? Z1 : Z1Sq.Square(); ECFieldElement L3 = t1.Add(T).Add(Z1Sq).Multiply(t1).Add(t2).Add(X3).Add(Z3); - return new SecT283K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT283K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -262,14 +249,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (A.IsZero) { - return new SecT283K1Point(curve, A, curve.B, IsCompressed); + return new SecT283K1Point(curve, A, curve.B); } ECFieldElement X3 = A.Square().Multiply(X2Z1Sq); ECFieldElement Z3 = A.Multiply(B).Multiply(Z1Sq); ECFieldElement L3 = A.Add(B).Square().MultiplyPlusProduct(T, L2plus1, Z3); - return new SecT283K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT283K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Negate() @@ -283,7 +270,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec // L is actually Lambda (X + Y/X) here ECFieldElement L = this.RawYCoord, Z = this.RawZCoords[0]; - return new SecT283K1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }, IsCompressed); + return new SecT283K1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT283R1Curve.cs b/crypto/src/math/ec/custom/sec/SecT283R1Curve.cs index c29413788..eae1427e1 100644 --- a/crypto/src/math/ec/custom/sec/SecT283R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecT283R1Curve.cs @@ -58,14 +58,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT283FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecT283R1Point(this, x, y, withCompression); + return new SecT283R1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecT283R1Point(this, x, y, zs, withCompression); + return new SecT283R1Point(this, x, y, zs); } public override bool IsKoblitz @@ -170,7 +170,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(ulong[] x, ulong[] y) { - return m_outer.CreateRawPoint(new SecT283FieldElement(x), new SecT283FieldElement(y), SECT283R1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecT283FieldElement(x), new SecT283FieldElement(y), SECT283R1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT283R1Point.cs b/crypto/src/math/ec/custom/sec/SecT283R1Point.cs index 8c4092d63..761ab2b88 100644 --- a/crypto/src/math/ec/custom/sec/SecT283R1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecT283R1Point.cs @@ -5,26 +5,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecT283R1Point : AbstractF2mPoint { - /** - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecT283R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecT283R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(bool)} - */ - public SecT283R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecT283R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecT283R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -134,7 +121,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = L.Square().Add(L).Add(X1).AddOne(); if (X3.IsZero) { - return new SecT283R1Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT283R1Point(curve, X3, curve.B.Sqrt()); } ECFieldElement Y3 = L.Multiply(X1.Add(X3)).Add(X3).Add(Y1); @@ -151,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = AU1.Multiply(AU2); if (X3.IsZero) { - return new SecT283R1Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT283R1Point(curve, X3, curve.B.Sqrt()); } ECFieldElement ABZ2 = A.Multiply(B); @@ -169,7 +156,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec } } - return new SecT283R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT283R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Twice() @@ -194,7 +181,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement T = L1.Square().Add(L1Z1).Add(Z1Sq); if (T.IsZero) { - return new SecT283R1Point(curve, T, curve.B.Sqrt(), IsCompressed); + return new SecT283R1Point(curve, T, curve.B.Sqrt()); } ECFieldElement X3 = T.Square(); @@ -203,7 +190,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement X1Z1 = Z1IsOne ? X1 : X1.Multiply(Z1); ECFieldElement L3 = X1Z1.SquarePlusProduct(T, L1Z1).Add(X3).Add(Z3); - return new SecT283R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT283R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -251,14 +238,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (A.IsZero) { - return new SecT283R1Point(curve, A, curve.B.Sqrt(), IsCompressed); + return new SecT283R1Point(curve, A, curve.B.Sqrt()); } ECFieldElement X3 = A.Square().Multiply(X2Z1Sq); ECFieldElement Z3 = A.Multiply(B).Multiply(Z1Sq); ECFieldElement L3 = A.Add(B).Square().MultiplyPlusProduct(T, L2.AddOne(), Z3); - return new SecT283R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT283R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Negate() @@ -272,7 +259,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec // L is actually Lambda (X + Y/X) here ECFieldElement L = this.RawYCoord, Z = this.RawZCoords[0]; - return new SecT283R1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }, IsCompressed); + return new SecT283R1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT409K1Curve.cs b/crypto/src/math/ec/custom/sec/SecT409K1Curve.cs index 9e5fe88c7..dfb3ea614 100644 --- a/crypto/src/math/ec/custom/sec/SecT409K1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecT409K1Curve.cs @@ -64,14 +64,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT409FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecT409K1Point(this, x, y, withCompression); + return new SecT409K1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecT409K1Point(this, x, y, zs, withCompression); + return new SecT409K1Point(this, x, y, zs); } public override bool IsKoblitz @@ -176,7 +176,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(ulong[] x, ulong[] y) { - return m_outer.CreateRawPoint(new SecT409FieldElement(x), new SecT409FieldElement(y), SECT409K1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecT409FieldElement(x), new SecT409FieldElement(y), SECT409K1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT409K1Point.cs b/crypto/src/math/ec/custom/sec/SecT409K1Point.cs index b127aea0d..e98fc77f0 100644 --- a/crypto/src/math/ec/custom/sec/SecT409K1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecT409K1Point.cs @@ -5,32 +5,19 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecT409K1Point : AbstractF2mPoint { - /** - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecT409K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecT409K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(bool)} - */ - public SecT409K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecT409K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecT409K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } protected override ECPoint Detach() { - return new SecT409K1Point(null, this.AffineXCoord, this.AffineYCoord); // earlier JDK + return new SecT409K1Point(null, this.AffineXCoord, this.AffineYCoord); } public override ECFieldElement YCoord @@ -134,7 +121,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = L.Square().Add(L).Add(X1); if (X3.IsZero) { - return new SecT409K1Point(curve, X3, curve.B, IsCompressed); + return new SecT409K1Point(curve, X3, curve.B); } ECFieldElement Y3 = L.Multiply(X1.Add(X3)).Add(X3).Add(Y1); @@ -151,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = AU1.Multiply(AU2); if (X3.IsZero) { - return new SecT409K1Point(curve, X3, curve.B, IsCompressed); + return new SecT409K1Point(curve, X3, curve.B); } ECFieldElement ABZ2 = A.Multiply(B); @@ -169,7 +156,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec } } - return new SecT409K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT409K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Twice() @@ -202,7 +189,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (T.IsZero) { - return new SecT409K1Point(curve, T, curve.B, IsCompressed); + return new SecT409K1Point(curve, T, curve.B); } ECFieldElement X3 = T.Square(); @@ -212,7 +199,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement t2 = Z1IsOne ? Z1 : Z1Sq.Square(); ECFieldElement L3 = t1.Add(T).Add(Z1Sq).Multiply(t1).Add(t2).Add(X3).Add(Z3); - return new SecT409K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT409K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -262,14 +249,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (A.IsZero) { - return new SecT409K1Point(curve, A, curve.B, IsCompressed); + return new SecT409K1Point(curve, A, curve.B); } ECFieldElement X3 = A.Square().Multiply(X2Z1Sq); ECFieldElement Z3 = A.Multiply(B).Multiply(Z1Sq); ECFieldElement L3 = A.Add(B).Square().MultiplyPlusProduct(T, L2plus1, Z3); - return new SecT409K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT409K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Negate() @@ -283,7 +270,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec // L is actually Lambda (X + Y/X) here ECFieldElement L = this.RawYCoord, Z = this.RawZCoords[0]; - return new SecT409K1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }, IsCompressed); + return new SecT409K1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT409R1Curve.cs b/crypto/src/math/ec/custom/sec/SecT409R1Curve.cs index 845c14b40..796f18bca 100644 --- a/crypto/src/math/ec/custom/sec/SecT409R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecT409R1Curve.cs @@ -58,14 +58,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT409FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecT409R1Point(this, x, y, withCompression); + return new SecT409R1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecT409R1Point(this, x, y, zs, withCompression); + return new SecT409R1Point(this, x, y, zs); } public override bool IsKoblitz @@ -170,7 +170,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(ulong[] x, ulong[] y) { - return m_outer.CreateRawPoint(new SecT409FieldElement(x), new SecT409FieldElement(y), SECT409R1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecT409FieldElement(x), new SecT409FieldElement(y), SECT409R1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT409R1Point.cs b/crypto/src/math/ec/custom/sec/SecT409R1Point.cs index 546b10795..56b7c444c 100644 --- a/crypto/src/math/ec/custom/sec/SecT409R1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecT409R1Point.cs @@ -5,26 +5,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecT409R1Point : AbstractF2mPoint { - /** - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecT409R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecT409R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(bool)} - */ - public SecT409R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecT409R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecT409R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -134,7 +121,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = L.Square().Add(L).Add(X1).AddOne(); if (X3.IsZero) { - return new SecT409R1Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT409R1Point(curve, X3, curve.B.Sqrt()); } ECFieldElement Y3 = L.Multiply(X1.Add(X3)).Add(X3).Add(Y1); @@ -151,7 +138,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = AU1.Multiply(AU2); if (X3.IsZero) { - return new SecT409R1Point(curve, X3, curve.B.Sqrt(), IsCompressed); + return new SecT409R1Point(curve, X3, curve.B.Sqrt()); } ECFieldElement ABZ2 = A.Multiply(B); @@ -169,7 +156,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec } } - return new SecT409R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT409R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Twice() @@ -194,7 +181,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement T = L1.Square().Add(L1Z1).Add(Z1Sq); if (T.IsZero) { - return new SecT409R1Point(curve, T, curve.B.Sqrt(), IsCompressed); + return new SecT409R1Point(curve, T, curve.B.Sqrt()); } ECFieldElement X3 = T.Square(); @@ -203,7 +190,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement X1Z1 = Z1IsOne ? X1 : X1.Multiply(Z1); ECFieldElement L3 = X1Z1.SquarePlusProduct(T, L1Z1).Add(X3).Add(Z3); - return new SecT409R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT409R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -251,14 +238,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (A.IsZero) { - return new SecT409R1Point(curve, A, curve.B.Sqrt(), IsCompressed); + return new SecT409R1Point(curve, A, curve.B.Sqrt()); } ECFieldElement X3 = A.Square().Multiply(X2Z1Sq); ECFieldElement Z3 = A.Multiply(B).Multiply(Z1Sq); ECFieldElement L3 = A.Add(B).Square().MultiplyPlusProduct(T, L2.AddOne(), Z3); - return new SecT409R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT409R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Negate() @@ -272,7 +259,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec // L is actually Lambda (X + Y/X) here ECFieldElement L = this.RawYCoord, Z = this.RawZCoords[0]; - return new SecT409R1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }, IsCompressed); + return new SecT409R1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT571K1Curve.cs b/crypto/src/math/ec/custom/sec/SecT571K1Curve.cs index 544a1ba4b..79628cef3 100644 --- a/crypto/src/math/ec/custom/sec/SecT571K1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecT571K1Curve.cs @@ -64,14 +64,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT571FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecT571K1Point(this, x, y, withCompression); + return new SecT571K1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecT571K1Point(this, x, y, zs, withCompression); + return new SecT571K1Point(this, x, y, zs); } public override bool IsKoblitz @@ -176,7 +176,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(ulong[] x, ulong[] y) { - return m_outer.CreateRawPoint(new SecT571FieldElement(x), new SecT571FieldElement(y), SECT571K1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecT571FieldElement(x), new SecT571FieldElement(y), SECT571K1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT571K1Point.cs b/crypto/src/math/ec/custom/sec/SecT571K1Point.cs index 0f132c84c..e5c3cc62f 100644 --- a/crypto/src/math/ec/custom/sec/SecT571K1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecT571K1Point.cs @@ -7,32 +7,19 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecT571K1Point : AbstractF2mPoint { - /** - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecT571K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecT571K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(bool)} - */ - public SecT571K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecT571K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecT571K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } protected override ECPoint Detach() { - return new SecT571K1Point(null, this.AffineXCoord, this.AffineYCoord); // earlier JDK + return new SecT571K1Point(null, this.AffineXCoord, this.AffineYCoord); } public override ECFieldElement YCoord @@ -154,7 +141,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = (SecT571FieldElement)L.Square().Add(L).Add(X1); if (X3.IsZero) { - return new SecT571K1Point(curve, X3, curve.B, IsCompressed); + return new SecT571K1Point(curve, X3, curve.B); } ECFieldElement Y3 = L.Multiply(X1.Add(X3)).Add(X3).Add(Y1); @@ -178,7 +165,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (X3.IsZero) { - return new SecT571K1Point(curve, X3, curve.B, IsCompressed); + return new SecT571K1Point(curve, X3, curve.B); } Z3 = new SecT571FieldElement(t3); @@ -207,7 +194,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec } } - return new SecT571K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT571K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Twice() @@ -240,7 +227,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (T.IsZero) { - return new SecT571K1Point(curve, T, curve.B, IsCompressed); + return new SecT571K1Point(curve, T, curve.B); } ECFieldElement X3 = T.Square(); @@ -250,7 +237,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec ECFieldElement t2 = Z1IsOne ? Z1 : Z1Sq.Square(); ECFieldElement L3 = t1.Add(T).Add(Z1Sq).Multiply(t1).Add(t2).Add(X3).Add(Z3); - return new SecT571K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT571K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -300,14 +287,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (A.IsZero) { - return new SecT571K1Point(curve, A, curve.B, IsCompressed); + return new SecT571K1Point(curve, A, curve.B); } ECFieldElement X3 = A.Square().Multiply(X2Z1Sq); ECFieldElement Z3 = A.Multiply(B).Multiply(Z1Sq); ECFieldElement L3 = A.Add(B).Square().MultiplyPlusProduct(T, L2plus1, Z3); - return new SecT571K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT571K1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Negate() @@ -321,7 +308,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec // L is actually Lambda (X + Y/X) here ECFieldElement L = this.RawYCoord, Z = this.RawZCoords[0]; - return new SecT571K1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }, IsCompressed); + return new SecT571K1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT571R1Curve.cs b/crypto/src/math/ec/custom/sec/SecT571R1Curve.cs index 67343b0c9..b64cfb498 100644 --- a/crypto/src/math/ec/custom/sec/SecT571R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecT571R1Curve.cs @@ -62,14 +62,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT571FieldElement(x); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) { - return new SecT571R1Point(this, x, y, withCompression); + return new SecT571R1Point(this, x, y); } - protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) + protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { - return new SecT571R1Point(this, x, y, zs, withCompression); + return new SecT571R1Point(this, x, y, zs); } public override bool IsKoblitz @@ -174,7 +174,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private ECPoint CreatePoint(ulong[] x, ulong[] y) { - return m_outer.CreateRawPoint(new SecT571FieldElement(x), new SecT571FieldElement(y), SECT571R1_AFFINE_ZS, false); + return m_outer.CreateRawPoint(new SecT571FieldElement(x), new SecT571FieldElement(y), SECT571R1_AFFINE_ZS); } } } diff --git a/crypto/src/math/ec/custom/sec/SecT571R1Point.cs b/crypto/src/math/ec/custom/sec/SecT571R1Point.cs index 6a82a5ef5..1ba7909f8 100644 --- a/crypto/src/math/ec/custom/sec/SecT571R1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecT571R1Point.cs @@ -7,26 +7,13 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecT571R1Point : AbstractF2mPoint { - /** - * @deprecated Use ECCurve.createPoint to construct points - */ - public SecT571R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) - : this(curve, x, y, false) + internal SecT571R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y) + : base(curve, x, y) { } - /** - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(bool)} - */ - public SecT571R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) - : base(curve, x, y, withCompression) - { - if ((x == null) != (y == null)) - throw new ArgumentException("Exactly one of the field elements is null"); - } - - internal SecT571R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression) - : base(curve, x, y, zs, withCompression) + internal SecT571R1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) + : base(curve, x, y, zs) { } @@ -154,7 +141,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec X3 = (SecT571FieldElement)L.Square().Add(L).Add(X1).AddOne(); if (X3.IsZero) { - return new SecT571R1Point(curve, X3, SecT571R1Curve.SecT571R1_B_SQRT, IsCompressed); + return new SecT571R1Point(curve, X3, SecT571R1Curve.SecT571R1_B_SQRT); } ECFieldElement Y3 = L.Multiply(X1.Add(X3)).Add(X3).Add(Y1); @@ -178,7 +165,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (X3.IsZero) { - return new SecT571R1Point(curve, X3, SecT571R1Curve.SecT571R1_B_SQRT, IsCompressed); + return new SecT571R1Point(curve, X3, SecT571R1Curve.SecT571R1_B_SQRT); } Z3 = new SecT571FieldElement(t3); @@ -206,7 +193,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec } } - return new SecT571R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT571R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Twice() @@ -247,7 +234,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (Nat576.IsZero64(T)) { - return new SecT571R1Point(curve, new SecT571FieldElement(T), SecT571R1Curve.SecT571R1_B_SQRT, IsCompressed); + return new SecT571R1Point(curve, new SecT571FieldElement(T), SecT571R1Curve.SecT571R1_B_SQRT); } ulong[] tt = Nat576.CreateExt64(); @@ -277,7 +264,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec SecT571Field.AddBothTo(X3.x, Z3.x, t2); SecT571FieldElement L3 = new SecT571FieldElement(t2); - return new SecT571R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT571R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint TwicePlus(ECPoint b) @@ -325,14 +312,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec if (A.IsZero) { - return new SecT571R1Point(curve, A, SecT571R1Curve.SecT571R1_B_SQRT, IsCompressed); + return new SecT571R1Point(curve, A, SecT571R1Curve.SecT571R1_B_SQRT); } ECFieldElement X3 = A.Square().Multiply(X2Z1Sq); ECFieldElement Z3 = A.Multiply(B).Multiply(Z1Sq); ECFieldElement L3 = A.Add(B).Square().MultiplyPlusProduct(T, L2.AddOne(), Z3); - return new SecT571R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }, IsCompressed); + return new SecT571R1Point(curve, X3, L3, new ECFieldElement[] { Z3 }); } public override ECPoint Negate() @@ -346,7 +333,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec // L is actually Lambda (X + Y/X) here ECFieldElement L = this.RawYCoord, Z = this.RawZCoords[0]; - return new SecT571R1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }, IsCompressed); + return new SecT571R1Point(Curve, X, L.Add(Z), new ECFieldElement[] { Z }); } } } |