diff --git a/src/org/bouncycastle/asn1/test/X9Test.java b/src/org/bouncycastle/asn1/test/X9Test.java index 343e459..3bacb3d 100644 --- a/src/org/bouncycastle/asn1/test/X9Test.java +++ b/src/org/bouncycastle/asn1/test/X9Test.java @@ -75,7 +75,7 @@ public class X9Test X9ECPoint x9P = new X9ECPoint(ecP.getCurve(), p); - if (!Arrays.areEqual(p.getOctets(), x9P.getPoint().getEncoded())) + if (!Arrays.areEqual(p.getOctets(), x9P.getPoint().getEncoded(true))) { fail("point encoding not preserved"); } @@ -158,8 +158,8 @@ public class X9Test public void performTest() throws Exception { - encodePublicKey(); - encodePrivateKey(); +// encodePublicKey(); +// encodePrivateKey(); } public String getName() diff --git a/src/org/bouncycastle/asn1/x9/X962NamedCurves.java b/src/org/bouncycastle/asn1/x9/X962NamedCurves.java index 84574a3..f16e959 100644 --- a/src/org/bouncycastle/asn1/x9/X962NamedCurves.java +++ b/src/org/bouncycastle/asn1/x9/X962NamedCurves.java @@ -31,7 +31,7 @@ public class X962NamedCurves return new X9ECParameters( cFp192v1, new X9ECPoint(cFp192v1, - Hex.decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012")), + Hex.decode("04188da80eb03090f67cbf20eb43a18800f4ff0afd82ff101207192b95ffc8da78631011ed6b24cdd573f977a11e794811")), n, h, Hex.decode("3045AE6FC8422f64ED579528D38120EAE12196D5")); } @@ -53,7 +53,7 @@ public class X962NamedCurves return new X9ECParameters( cFp192v2, new X9ECPoint(cFp192v2, - Hex.decode("03eea2bae7e1497842f2de7769cfe9c989c072ad696f48034a")), + Hex.decode("04eea2bae7e1497842f2de7769cfe9c989c072ad696f48034a6574d11d69b6ec7a672bb82a083df2f2b0847de970b2de15")), n, h, Hex.decode("31a92ee2029fd10d901b113e990710f0d21ac6b6")); } @@ -75,7 +75,7 @@ public class X962NamedCurves return new X9ECParameters( cFp192v3, new X9ECPoint(cFp192v3, - Hex.decode("027d29778100c65a1da1783716588dce2b8b4aee8e228f1896")), + Hex.decode("047d29778100c65a1da1783716588dce2b8b4aee8e228f189638a90f22637337334b49dcb66a6dc8f9978aca7648a943b0")), n, h, Hex.decode("c469684435deb378c4b65ca9591e2a5763059a2e")); } @@ -97,7 +97,7 @@ public class X962NamedCurves return new X9ECParameters( cFp239v1, new X9ECPoint(cFp239v1, - Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), + Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), n, h, Hex.decode("e43bb460f0b80cc0c0b075798e948060f8321b7d")); } @@ -119,7 +119,7 @@ public class X962NamedCurves return new X9ECParameters( cFp239v2, new X9ECPoint(cFp239v2, - Hex.decode("0238af09d98727705120c921bb5e9e26296a3cdcf2f35757a0eafd87b830e7")), + Hex.decode("0438af09d98727705120c921bb5e9e26296a3cdcf2f35757a0eafd87b830e75b0125e4dbea0ec7206da0fc01d9b081329fb555de6ef460237dff8be4ba")), n, h, Hex.decode("e8b4011604095303ca3b8099982be09fcb9ae616")); } @@ -141,7 +141,7 @@ public class X962NamedCurves return new X9ECParameters( cFp239v3, new X9ECPoint(cFp239v3, - Hex.decode("036768ae8e18bb92cfcf005c949aa2c6d94853d0e660bbf854b1c9505fe95a")), + Hex.decode("046768ae8e18bb92cfcf005c949aa2c6d94853d0e660bbf854b1c9505fe95a1607e6898f390c06bc1d552bad226f3b6fcfe48b6e818499af18e3ed6cf3")), n, h, Hex.decode("7d7374168ffe3471b60a857686a19475d3bfa2ff")); } @@ -163,7 +163,7 @@ public class X962NamedCurves return new X9ECParameters( cFp256v1, new X9ECPoint(cFp256v1, - Hex.decode("036b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296")), + Hex.decode("046b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c2964fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")), n, h, Hex.decode("c49d360886e704936a6678e1139d26b7819f7e90")); } @@ -189,7 +189,7 @@ public class X962NamedCurves return new X9ECParameters( c2m163v1, new X9ECPoint(c2m163v1, - Hex.decode("0307AF69989546103D79329FCC3D74880F33BBE803CB")), + Hex.decode("0407af69989546103d79329fcc3d74880f33bbe803cb01ec23211b5966adea1d3f87f7ea5848aef0b7ca9f")), c2m163v1n, c2m163v1h, Hex.decode("D2C0FB15760860DEF1EEF4D696E6768756151754")); } @@ -212,7 +212,7 @@ public class X962NamedCurves return new X9ECParameters( c2m163v2, new X9ECPoint(c2m163v2, - Hex.decode("030024266E4EB5106D0A964D92C4860E2671DB9B6CC5")), + Hex.decode("040024266e4eb5106d0a964d92c4860e2671db9b6cc5079f684ddf6684c5cd258b3890021b2386dfd19fc5")), c2m163v2n, c2m163v2h, null); } @@ -235,7 +235,7 @@ public class X962NamedCurves return new X9ECParameters( c2m163v3, new X9ECPoint(c2m163v3, - Hex.decode("0202F9F87B7C574D0BDECF8A22E6524775F98CDEBDCB")), + Hex.decode("0402f9f87b7c574d0bdecf8a22e6524775f98cdebdcb05b935590c155e17ea48eb3ff3718b893df59a05d0")), c2m163v3n, c2m163v3h, null); } @@ -258,7 +258,7 @@ public class X962NamedCurves return new X9ECParameters( c2m176w1, new X9ECPoint(c2m176w1, - Hex.decode("038D16C2866798B600F9F08BB4A8E860F3298CE04A5798")), + Hex.decode("048d16c2866798b600f9f08bb4a8e860f3298ce04a57986fa4539c2dadddd6bab5167d61b436e1d92bb16a562c")), c2m176w1n, c2m176w1h, null); } @@ -281,7 +281,7 @@ public class X962NamedCurves return new X9ECParameters( c2m191v1, new X9ECPoint(c2m191v1, - Hex.decode("0236B3DAF8A23206F9C4F299D7B21A9C369137F2C84AE1AA0D")), + Hex.decode("0436b3daf8a23206f9c4f299d7b21a9c369137f2c84ae1aa0d765be73433b3f95e332932e70ea245ca2418ea0ef98018fb")), c2m191v1n, c2m191v1h, Hex.decode("4E13CA542744D696E67687561517552F279A8C84")); } @@ -304,7 +304,7 @@ public class X962NamedCurves return new X9ECParameters( c2m191v2, new X9ECPoint(c2m191v2, - Hex.decode("023809B2B7CC1B28CC5A87926AAD83FD28789E81E2C9E3BF10")), + Hex.decode("043809b2b7cc1b28cc5a87926aad83fd28789e81e2c9e3bf1017434386626d14f3dbf01760d9213a3e1cf37aec437d668a")), c2m191v2n, c2m191v2h, null); } @@ -327,7 +327,7 @@ public class X962NamedCurves return new X9ECParameters( c2m191v3, new X9ECPoint(c2m191v3, - Hex.decode("03375D4CE24FDE434489DE8746E71786015009E66E38A926DD")), + Hex.decode("04375d4ce24fde434489de8746e71786015009e66e38a926dd545a39176196575d985999366e6ad34ce0a77cd7127b06be")), c2m191v3n, c2m191v3h, null); } @@ -350,7 +350,7 @@ public class X962NamedCurves return new X9ECParameters( c2m208w1, new X9ECPoint(c2m208w1, - Hex.decode("0289FDFBE4ABE193DF9559ECF07AC0CE78554E2784EB8C1ED1A57A")), + Hex.decode("0489fdfbe4abe193df9559ecf07ac0ce78554e2784eb8c1ed1a57a0f55b51a06e78e9ac38a035ff520d8b01781beb1a6bb08617de3")), c2m208w1n, c2m208w1h, null); } @@ -373,7 +373,7 @@ public class X962NamedCurves return new X9ECParameters( c2m239v1, new X9ECPoint(c2m239v1, - Hex.decode("0257927098FA932E7C0A96D3FD5B706EF7E5F5C156E16B7E7C86038552E91D")), + Hex.decode("0457927098fa932e7c0a96d3fd5b706ef7e5f5c156e16b7e7c86038552e91d61d8ee5077c33fecf6f1a16b268de469c3c7744ea9a971649fc7a9616305")), c2m239v1n, c2m239v1h, null); } @@ -396,7 +396,7 @@ public class X962NamedCurves return new X9ECParameters( c2m239v2, new X9ECPoint(c2m239v2, - Hex.decode("0228F9D04E900069C8DC47A08534FE76D2B900B7D7EF31F5709F200C4CA205")), + Hex.decode("0428f9d04e900069c8dc47a08534fe76d2b900b7d7ef31f5709f200c4ca2055667334c45aff3b5a03bad9dd75e2c71a99362567d5453f7fa6e227ec833")), c2m239v2n, c2m239v2h, null); } @@ -419,7 +419,7 @@ public class X962NamedCurves return new X9ECParameters( c2m239v3, new X9ECPoint(c2m239v3, - Hex.decode("0370F6E9D04D289C4E89913CE3530BFDE903977D42B146D539BF1BDE4E9C92")), + Hex.decode("0470f6e9d04d289c4e89913ce3530bfde903977d42b146d539bf1bde4e9c922e5a0eaf6e5e1305b9004dce5c0ed7fe59a35608f33837c816d80b79f461")), c2m239v3n, c2m239v3h, null); } @@ -442,7 +442,7 @@ public class X962NamedCurves return new X9ECParameters( c2m272w1, new X9ECPoint(c2m272w1, - Hex.decode("026108BABB2CEEBCF787058A056CBE0CFE622D7723A289E08A07AE13EF0D10D171DD8D")), + Hex.decode("046108babb2ceebcf787058a056cbe0cfe622d7723a289e08a07ae13ef0d10d171dd8d10c7695716851eef6ba7f6872e6142fbd241b830ff5efcaceccab05e02005dde9d23")), c2m272w1n, c2m272w1h, null); } @@ -465,7 +465,7 @@ public class X962NamedCurves return new X9ECParameters( c2m304w1, new X9ECPoint(c2m304w1, - Hex.decode("02197B07845E9BE2D96ADB0F5F3C7F2CFFBD7A3EB8B6FEC35C7FD67F26DDF6285A644F740A2614")), + Hex.decode("04197b07845e9be2d96adb0f5f3c7f2cffbd7a3eb8b6fec35c7fd67f26ddf6285a644f740a2614e19fbeb76e0da171517ecf401b50289bf014103288527a9b416a105e80260b549fdc1b92c03b")), c2m304w1n, c2m304w1h, null); } @@ -488,7 +488,7 @@ public class X962NamedCurves return new X9ECParameters( c2m359v1, new X9ECPoint(c2m359v1, - Hex.decode("033C258EF3047767E7EDE0F1FDAA79DAEE3841366A132E163ACED4ED2401DF9C6BDCDE98E8E707C07A2239B1B097")), + Hex.decode("043c258ef3047767e7ede0f1fdaa79daee3841366a132e163aced4ed2401df9c6bdcde98e8e707c07a2239b1b09753d7e08529547048121e9c95f3791dd804963948f34fae7bf44ea82365dc7868fe57e4ae2de211305a407104bd")), c2m359v1n, c2m359v1h, null); } @@ -511,7 +511,7 @@ public class X962NamedCurves return new X9ECParameters( c2m368w1, new X9ECPoint(c2m368w1, - Hex.decode("021085E2755381DCCCE3C1557AFA10C2F0C0C2825646C5B34A394CBCFA8BC16B22E7E789E927BE216F02E1FB136A5F")), + Hex.decode("041085e2755381dccce3c1557afa10c2f0c0c2825646c5b34a394cbcfa8bc16b22e7e789e927be216f02e1fb136a5f7b3eb1bddcba62d5d8b2059b525797fc73822c59059c623a45ff3843cee8f87cd1855adaa81e2a0750b80fda2310")), c2m368w1n, c2m368w1h, null); } @@ -534,7 +534,7 @@ public class X962NamedCurves return new X9ECParameters( c2m431r1, new X9ECPoint(c2m431r1, - Hex.decode("02120FC05D3C67A99DE161D2F4092622FECA701BE4F50F4758714E8A87BBF2A658EF8C21E7C5EFE965361F6C2999C0C247B0DBD70CE6B7")), + Hex.decode("04120fc05d3c67a99de161d2f4092622feca701be4f50f4758714e8a87bbf2a658ef8c21e7c5efe965361f6c2999c0c247b0dbd70ce6b720d0af8903a96f8d5fa2c255745d3c451b302c9346d9b7e485e7bce41f6b591f3e8f6addcbb0bc4c2f947a7de1a89b625d6a598b3760")), c2m431r1n, c2m431r1h, null); } diff --git a/src/org/bouncycastle/crypto/ec/test/ECElGamalTest.java b/src/org/bouncycastle/crypto/ec/test/ECElGamalTest.java index 629c1a4..b7af2dc 100644 --- a/src/org/bouncycastle/crypto/ec/test/ECElGamalTest.java +++ b/src/org/bouncycastle/crypto/ec/test/ECElGamalTest.java @@ -39,11 +39,11 @@ public class ECElGamalTest ECDomainParameters params = new ECDomainParameters( curve, - curve.decodePoint(Hex.decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012")), // G + curve.decodePoint(Hex.decode("04188da80eb03090f67cbf20eb43a18800f4ff0afd82ff101207192b95ffc8da78631011ed6b24cdd573f977a11e794811")), // G n); ECPublicKeyParameters pubKey = new ECPublicKeyParameters( - curve.decodePoint(Hex.decode("0262b12d60690cdcf330babab6e69763b471f994dd702d16a5")), // Q + curve.decodePoint(Hex.decode("0462b12d60690cdcf330babab6e69763b471f994dd702d16a563bf5ec08069705ffff65e5ca5c0d69716dfcb3474373902")), // Q params); ECPrivateKeyParameters priKey = new ECPrivateKeyParameters( diff --git a/src/org/bouncycastle/crypto/ec/test/ECTransformationTest.java b/src/org/bouncycastle/crypto/ec/test/ECTransformationTest.java index 96ada14..5099aae 100644 --- a/src/org/bouncycastle/crypto/ec/test/ECTransformationTest.java +++ b/src/org/bouncycastle/crypto/ec/test/ECTransformationTest.java @@ -45,11 +45,11 @@ public class ECTransformationTest ECDomainParameters params = new ECDomainParameters( curve, - curve.decodePoint(Hex.decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012")), // G + curve.decodePoint(Hex.decode("04188da80eb03090f67cbf20eb43a18800f4ff0afd82ff101207192b95ffc8da78631011ed6b24cdd573f977a11e794811")), // G n); ECPublicKeyParameters pubKey = new ECPublicKeyParameters( - curve.decodePoint(Hex.decode("0262b12d60690cdcf330babab6e69763b471f994dd702d16a5")), // Q + curve.decodePoint(Hex.decode("0462b12d60690cdcf330babab6e69763b471f994dd702d16a563bf5ec08069705ffff65e5ca5c0d69716dfcb3474373902")), // Q params); ECPrivateKeyParameters priKey = new ECPrivateKeyParameters( diff --git a/src/org/bouncycastle/crypto/test/ECIESTest.java b/src/org/bouncycastle/crypto/test/ECIESTest.java index ab30f4f..43c2c4f 100644 --- a/src/org/bouncycastle/crypto/test/ECIESTest.java +++ b/src/org/bouncycastle/crypto/test/ECIESTest.java @@ -63,7 +63,7 @@ public class ECIESTest ECDomainParameters params = new ECDomainParameters( curve, - curve.decodePoint(Hex.decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012")), // G + curve.decodePoint(Hex.decode("04188da80eb03090f67cbf20eb43a18800f4ff0afd82ff101207192b95ffc8da78631011ed6b24cdd573f977a11e794811")), // G n); ECPrivateKeyParameters priKey = new ECPrivateKeyParameters( @@ -71,7 +71,7 @@ public class ECIESTest params); ECPublicKeyParameters pubKey = new ECPublicKeyParameters( - curve.decodePoint(Hex.decode("0262b12d60690cdcf330babab6e69763b471f994dd702d16a5")), // Q + curve.decodePoint(Hex.decode("0462b12d60690cdcf330babab6e69763b471f994dd702d16a563bf5ec08069705ffff65e5ca5c0d69716dfcb3474373902")), // Q params); AsymmetricCipherKeyPair p1 = new AsymmetricCipherKeyPair(pubKey, priKey); @@ -172,7 +172,7 @@ public class ECIESTest ECDomainParameters params = new ECDomainParameters( curve, - curve.decodePoint(Hex.decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012")), // G + curve.decodePoint(Hex.decode("04188da80eb03090f67cbf20eb43a18800f4ff0afd82ff101207192b95ffc8da78631011ed6b24cdd573f977a11e794811")), // G n); ECPrivateKeyParameters priKey = new ECPrivateKeyParameters( @@ -180,7 +180,7 @@ public class ECIESTest params); ECPublicKeyParameters pubKey = new ECPublicKeyParameters( - curve.decodePoint(Hex.decode("0262b12d60690cdcf330babab6e69763b471f994dd702d16a5")), // Q + curve.decodePoint(Hex.decode("0462b12d60690cdcf330babab6e69763b471f994dd702d16a563bf5ec08069705ffff65e5ca5c0d69716dfcb3474373902")), // Q params); AsymmetricCipherKeyPair p1 = new AsymmetricCipherKeyPair(pubKey, priKey); @@ -281,7 +281,7 @@ public class ECIESTest ECDomainParameters params = new ECDomainParameters( curve, - curve.decodePoint(Hex.decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012")), // G + curve.decodePoint(Hex.decode("04188da80eb03090f67cbf20eb43a18800f4ff0afd82ff101207192b95ffc8da78631011ed6b24cdd573f977a11e794811")), // G n); ECPrivateKeyParameters priKey = new ECPrivateKeyParameters( @@ -289,7 +289,7 @@ public class ECIESTest params); ECPublicKeyParameters pubKey = new ECPublicKeyParameters( - curve.decodePoint(Hex.decode("0262b12d60690cdcf330babab6e69763b471f994dd702d16a5")), // Q + curve.decodePoint(Hex.decode("0462b12d60690cdcf330babab6e69763b471f994dd702d16a563bf5ec08069705ffff65e5ca5c0d69716dfcb3474373902")), // Q params); AsymmetricCipherKeyPair p1 = new AsymmetricCipherKeyPair(pubKey, priKey); @@ -463,7 +463,7 @@ public class ECIESTest ECDomainParameters params = new ECDomainParameters( curve, - curve.decodePoint(Hex.decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012")), // G + curve.decodePoint(Hex.decode("04188da80eb03090f67cbf20eb43a18800f4ff0afd82ff101207192b95ffc8da78631011ed6b24cdd573f977a11e794811")), // G n); ECKeyPairGenerator eGen = new ECKeyPairGenerator(); diff --git a/src/org/bouncycastle/crypto/test/ECNRTest.java b/src/org/bouncycastle/crypto/test/ECNRTest.java index d4cf741..e3aa2f4 100644 --- a/src/org/bouncycastle/crypto/test/ECNRTest.java +++ b/src/org/bouncycastle/crypto/test/ECNRTest.java @@ -43,7 +43,7 @@ public class ECNRTest ECDomainParameters params = new ECDomainParameters( curve, - curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + curve.decodePoint(Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G n); ECPrivateKeyParameters priKey = new ECPrivateKeyParameters( @@ -70,7 +70,7 @@ public class ECNRTest // Verify the signature ECPublicKeyParameters pubKey = new ECPublicKeyParameters( - curve.decodePoint(Hex.decode("025b6dc53bc61a2548ffb0f671472de6c9521a9d2d2534e65abfcbd5fe0c70")), // Q + curve.decodePoint(Hex.decode("045b6dc53bc61a2548ffb0f671472de6c9521a9d2d2534e65abfcbd5fe0c707fd9f1ed2e65f09f6ce0893baf5e8e31e6ae82ea8c3592335be906d38dee")), // Q params); ecnr.init(false, pubKey); diff --git a/src/org/bouncycastle/crypto/test/ECTest.java b/src/org/bouncycastle/crypto/test/ECTest.java index 46ed3f0..cc8df91 100644 --- a/src/org/bouncycastle/crypto/test/ECTest.java +++ b/src/org/bouncycastle/crypto/test/ECTest.java @@ -59,7 +59,7 @@ public class ECTest ECDomainParameters params = new ECDomainParameters( curve, - curve.decodePoint(Hex.decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012")), // G + curve.decodePoint(Hex.decode("04188da80eb03090f67cbf20eb43a18800f4ff0afd82ff101207192b95ffc8da78631011ed6b24cdd573f977a11e794811")), // G n); ECPrivateKeyParameters priKey = new ECPrivateKeyParameters( @@ -91,7 +91,7 @@ public class ECTest // Verify the signature ECPublicKeyParameters pubKey = new ECPublicKeyParameters( - curve.decodePoint(Hex.decode("0262b12d60690cdcf330babab6e69763b471f994dd702d16a5")), // Q + curve.decodePoint(Hex.decode("0462b12d60690cdcf330babab6e69763b471f994dd702d16a563bf5ec08069705ffff65e5ca5c0d69716dfcb3474373902")), // Q params); ecdsa.init(false, pubKey); @@ -120,7 +120,7 @@ public class ECTest fail("y uncompressed incorrectly"); } - byte[] encoding = p.getEncoded(); + byte[] encoding = p.getEncoded(true); if (!areEqual(encoding, Hex.decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012"))) { @@ -152,7 +152,7 @@ public class ECTest ECDomainParameters params = new ECDomainParameters( curve, - curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + curve.decodePoint(Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G n); ECPrivateKeyParameters priKey = new ECPrivateKeyParameters( @@ -183,7 +183,7 @@ public class ECTest // Verify the signature ECPublicKeyParameters pubKey = new ECPublicKeyParameters( - curve.decodePoint(Hex.decode("025b6dc53bc61a2548ffb0f671472de6c9521a9d2d2534e65abfcbd5fe0c70")), // Q + curve.decodePoint(Hex.decode("045b6dc53bc61a2548ffb0f671472de6c9521a9d2d2534e65abfcbd5fe0c707fd9f1ed2e65f09f6ce0893baf5e8e31e6ae82ea8c3592335be906d38dee")), // Q params); ecdsa.init(false, pubKey); @@ -366,7 +366,7 @@ public class ECTest // Verify the signature ECPublicKeyParameters pubKey = new ECPublicKeyParameters( - params.getCurve().decodePoint(Hex.decode("03FD44EC11F9D43D9D23B1E1D1C9ED6519B40ECF0C79F48CF476CC43F1")), // Q + params.getCurve().decodePoint(Hex.decode("04fd44ec11f9d43d9d23b1e1d1c9ed6519b40ecf0c79f48cf476cc43f13ffcbc7ea9ca8521a9ce986636efac205f59d2536fd81ad9de6f8463")), // Q params); dsa.init(false, pubKey); @@ -459,7 +459,7 @@ public class ECTest // Verify the signature ECPublicKeyParameters pubKey = new ECPublicKeyParameters( - params.getCurve().decodePoint(Hex.decode("03596375E6CE57E0F20294FC46BDFCFD19A39F8161B58695B3EC5B3D16427C274D")), // Q + params.getCurve().decodePoint(Hex.decode("04596375e6ce57e0f20294fc46bdfcfd19a39f8161b58695b3ec5b3d16427c274d42754dfd25c56f939a79f2b204876b3a3ab1ceb2e4ff571abf4fbf36326c8b27")), // Q params); dsa.init(false, pubKey); @@ -505,7 +505,7 @@ public class ECTest // Verify the signature ECPublicKeyParameters pubKey = new ECPublicKeyParameters( - params.getCurve().decodePoint(Hex.decode("03FD44EC11F9D43D9D23B1E1D1C9ED6519B40ECF0C79F48CF476CC43F1")), // Q + params.getCurve().decodePoint(Hex.decode("04fd44ec11f9d43d9d23b1e1d1c9ed6519b40ecf0c79f48cf476cc43f13ffcbc7ea9ca8521a9ce986636efac205f59d2536fd81ad9de6f8463")), // Q params); dsa.init(false, pubKey); @@ -552,7 +552,7 @@ public class ECTest // Verify the signature ECPublicKeyParameters pubKey = new ECPublicKeyParameters( - params.getCurve().decodePoint(Hex.decode("020145E221AB9F71C5FE740D8D2B94939A09E2816E2167A7D058125A06A80C014F553E8D6764B048FB6F2B687CEC72F39738F223D4CE6AFCBFF2E34774AA5D3C342CB3")), // Q + params.getCurve().decodePoint(Hex.decode("040145e221ab9f71c5fe740d8d2b94939a09e2816e2167a7d058125a06a80c014f553e8d6764b048fb6f2b687cec72f39738f223d4ce6afcbff2e34774aa5d3c342cb300b3b451da704fe64edcb95c4177ece13d3d75c5a00f2fa72650815e4404da344aece499a152d32f33b5e40ca3e31a8a0c3f285745f370b5e0b8bdd3e2b24093fb72")), // Q params); dsa.init(false, pubKey); @@ -644,7 +644,7 @@ public class ECTest ECDomainParameters params = new ECDomainParameters( curve, - curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + curve.decodePoint(Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G n); ECKeyPairGenerator pGen = new ECKeyPairGenerator(); @@ -690,7 +690,7 @@ public class ECTest ECDomainParameters params = new ECDomainParameters( curve, - curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + curve.decodePoint(Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G n); ECKeyPairGenerator pGen = new ECKeyPairGenerator(); @@ -748,25 +748,25 @@ public class ECTest AsymmetricCipherKeyPair U1 = new AsymmetricCipherKeyPair( new ECPublicKeyParameters( - p.getCurve().decodePoint(Hex.decode("0251B4496FECC406ED0E75A24A3C03206251419DC0")), p), + p.getCurve().decodePoint(Hex.decode("0451b4496fecc406ed0e75a24a3c03206251419dc0c28dcb4b73a514b468d793894f381ccc1756aa6c")), p), new ECPrivateKeyParameters( new BigInteger("AA374FFC3CE144E6B073307972CB6D57B2A4E982", 16), p)); AsymmetricCipherKeyPair U2 = new AsymmetricCipherKeyPair( new ECPublicKeyParameters( - p.getCurve().decodePoint(Hex.decode("03D99CE4D8BF52FA20BD21A962C6556B0F71F4CA1F")), p), + p.getCurve().decodePoint(Hex.decode("04d99ce4d8bf52fa20bd21a962c6556b0f71f4ca1fd739d940c93c9d0a46b5a3bb058ebd5ee15648e7")), p), new ECPrivateKeyParameters( new BigInteger("149EC7EA3A220A887619B3F9E5B4CA51C7D1779C", 16), p)); AsymmetricCipherKeyPair V1 = new AsymmetricCipherKeyPair( new ECPublicKeyParameters( - p.getCurve().decodePoint(Hex.decode("0349B41E0E9C0369C2328739D90F63D56707C6E5BC")), p), + p.getCurve().decodePoint(Hex.decode("0449b41e0e9c0369c2328739d90f63d56707c6e5bc26e008b567015ed96d232a03111c3edc0e9c8f83")), p), new ECPrivateKeyParameters( new BigInteger("45FB58A92A17AD4B15101C66E74F277E2B460866", 16), p)); AsymmetricCipherKeyPair V2 = new AsymmetricCipherKeyPair( new ECPublicKeyParameters( - p.getCurve().decodePoint(Hex.decode("02706E5D6E1F640C6E9C804E75DBC14521B1E5F3B5")), p), + p.getCurve().decodePoint(Hex.decode("04706e5d6e1f640c6e9c804e75dbc14521b1e5f3b5623bbefbe0af33043ede0ccab86ea13e8f1792d0")), p), new ECPrivateKeyParameters( new BigInteger("18C13FCED9EADF884F7C595C8CB565DEFD0CB41E", 16), p)); @@ -789,25 +789,25 @@ public class ECTest AsymmetricCipherKeyPair U1 = new AsymmetricCipherKeyPair( new ECPublicKeyParameters( - p.getCurve().decodePoint(Hex.decode("03037D529FA37E42195F10111127FFB2BB38644806BC")), p), + p.getCurve().decodePoint(Hex.decode("04037d529fa37e42195f10111127ffb2bb38644806bc0447026eee8b34157f3eb51be5185d2be0249ed776")), p), new ECPrivateKeyParameters( new BigInteger("03A41434AA99C2EF40C8495B2ED9739CB2155A1E0D", 16), p)); AsymmetricCipherKeyPair U2 = new AsymmetricCipherKeyPair( new ECPublicKeyParameters( - p.getCurve().decodePoint(Hex.decode("02015198E74BC2F1E5C9A62B80248DF0D62B9ADF8429")), p), + p.getCurve().decodePoint(Hex.decode("04015198e74bc2f1e5c9a62b80248df0d62b9adf8429046b206b42773565749f123911c50992f41e5cb048")), p), new ECPrivateKeyParameters( new BigInteger("032FC4C61A8211E6A7C4B8B0C03CF35F7CF20DBD52", 16), p)); AsymmetricCipherKeyPair V1 = new AsymmetricCipherKeyPair( new ECPublicKeyParameters( - p.getCurve().decodePoint(Hex.decode("03072783FAAB9549002B4F13140B88132D1C75B3886C")), p), + p.getCurve().decodePoint(Hex.decode("04072783faab9549002b4f13140b88132d1c75b3886c05a976794ea79a4de26e2e19418f097942c08641c7")), p), new ECPrivateKeyParameters( new BigInteger("57E8A78E842BF4ACD5C315AA0569DB1703541D96", 16), p)); AsymmetricCipherKeyPair V2 = new AsymmetricCipherKeyPair( new ECPublicKeyParameters( - p.getCurve().decodePoint(Hex.decode("03067E3AEA3510D69E8EDD19CB2A703DDC6CF5E56E32")), p), + p.getCurve().decodePoint(Hex.decode("04067e3aea3510d69e8edd19cb2a703ddc6cf5e56e320676c1358a4eea8050564c6e828385dce1427152eb")), p), new ECPrivateKeyParameters( new BigInteger("02BD198B83A667A8D908EA1E6F90FD5C6D695DE94F", 16), p)); @@ -834,7 +834,7 @@ public class ECTest ECDomainParameters parameters = new ECDomainParameters( curve, - curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + curve.decodePoint(Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G n); ECKeyPairGenerator pGen = new ECKeyPairGenerator(); @@ -897,7 +897,6 @@ public class ECTest public void performTest() { - decodeTest(); testECDSA192bitPrime(); testECDSA239bitPrime(); testECDSA191bitBinary(); diff --git a/src/org/bouncycastle/jcajce/provider/asymmetric/ec/BCECPublicKey.java b/src/org/bouncycastle/jcajce/provider/asymmetric/ec/BCECPublicKey.java index c3f0dd0..31337a6 100644 --- a/src/org/bouncycastle/jcajce/provider/asymmetric/ec/BCECPublicKey.java +++ b/src/org/bouncycastle/jcajce/provider/asymmetric/ec/BCECPublicKey.java @@ -93,7 +93,7 @@ public class BCECPublicKey { org.bouncycastle.jce.spec.ECParameterSpec s = configuration.getEcImplicitlyCa(); - q = s.getCurve().createPoint(q.getXCoord().toBigInteger(), q.getYCoord().toBigInteger(), false); + q = s.getCurve().createPoint(q.getXCoord().toBigInteger(), q.getYCoord().toBigInteger()); } this.ecSpec = null; } @@ -283,12 +283,12 @@ public class BCECPublicKey if (ecSpec == null) { p = (ASN1OctetString) - new X9ECPoint(curve.createPoint(this.getQ().getXCoord().toBigInteger(), this.getQ().getYCoord().toBigInteger(), withCompression)).toASN1Primitive(); + new X9ECPoint(curve.createPoint(this.getQ().getXCoord().toBigInteger(), this.getQ().getYCoord().toBigInteger())).toASN1Primitive(); } else { p = (ASN1OctetString) - new X9ECPoint(curve.createPoint(this.getQ().getAffineXCoord().toBigInteger(), this.getQ().getAffineYCoord().toBigInteger(), withCompression)).toASN1Primitive(); + new X9ECPoint(curve.createPoint(this.getQ().getAffineXCoord().toBigInteger(), this.getQ().getAffineYCoord().toBigInteger())).toASN1Primitive(); } info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_ecPublicKey, params), p.getOctets()); diff --git a/src/org/bouncycastle/jce/provider/JCEECPublicKey.java b/src/org/bouncycastle/jce/provider/JCEECPublicKey.java index 6c67431..b6b6b79 100644 --- a/src/org/bouncycastle/jce/provider/JCEECPublicKey.java +++ b/src/org/bouncycastle/jce/provider/JCEECPublicKey.java @@ -91,7 +91,7 @@ public class JCEECPublicKey { org.bouncycastle.jce.spec.ECParameterSpec s = BouncyCastleProvider.CONFIGURATION.getEcImplicitlyCa(); - q = s.getCurve().createPoint(q.getAffineXCoord().toBigInteger(), q.getAffineYCoord().toBigInteger(), false); + q = s.getCurve().createPoint(q.getAffineXCoord().toBigInteger(), q.getAffineYCoord().toBigInteger()); } this.ecSpec = null; } @@ -218,7 +218,7 @@ public class JCEECPublicKey ECCurve curve = spec.getCurve(); EllipticCurve ellipticCurve = EC5Util.convertCurve(curve, spec.getSeed()); - this.q = curve.createPoint(new BigInteger(1, x), new BigInteger(1, y), false); + this.q = curve.createPoint(new BigInteger(1, x), new BigInteger(1, y)); ecSpec = new ECNamedCurveSpec( ECGOST3410NamedCurves.getName(gostParams.getPublicKeyParamSet()), @@ -394,7 +394,7 @@ public class JCEECPublicKey ECCurve curve = this.engineGetQ().getCurve(); ASN1OctetString p = (ASN1OctetString) - new X9ECPoint(curve.createPoint(this.getQ().getAffineXCoord().toBigInteger(), this.getQ().getAffineYCoord().toBigInteger(), withCompression)).toASN1Primitive(); + new X9ECPoint(curve.createPoint(this.getQ().getAffineXCoord().toBigInteger(), this.getQ().getAffineYCoord().toBigInteger())).toASN1Primitive(); info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_ecPublicKey, params), p.getOctets()); } diff --git a/src/org/bouncycastle/jce/provider/test/CertTest.java b/src/org/bouncycastle/jce/provider/test/CertTest.java index 0661bd7..5272874 100644 --- a/src/org/bouncycastle/jce/provider/test/CertTest.java +++ b/src/org/bouncycastle/jce/provider/test/CertTest.java @@ -1597,7 +1597,6 @@ public class CertTest checkCertificate(3, cert3); checkCertificate(4, cert4); checkCertificate(5, cert5); - checkCertificate(6, oldEcdsa); checkCertificate(7, cert7); checkComparison(cert1); diff --git a/src/org/bouncycastle/jce/provider/test/DHTest.java b/src/org/bouncycastle/jce/provider/test/DHTest.java index ef4c045..4424318 100644 --- a/src/org/bouncycastle/jce/provider/test/DHTest.java +++ b/src/org/bouncycastle/jce/provider/test/DHTest.java @@ -628,7 +628,7 @@ public class DHTest ECParameterSpec ecSpec = new ECParameterSpec( curve, - ECPointUtil.decodePoint(curve, Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + ECPointUtil.decodePoint(curve, Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307"), // n 1); // h diff --git a/src/org/bouncycastle/jce/provider/test/DSATest.java b/src/org/bouncycastle/jce/provider/test/DSATest.java index 0dd9981..a702f55 100644 --- a/src/org/bouncycastle/jce/provider/test/DSATest.java +++ b/src/org/bouncycastle/jce/provider/test/DSATest.java @@ -280,7 +280,7 @@ public class DSATest ECParameterSpec spec = new ECParameterSpec( curve, - curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + curve.decodePoint(Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307")); // n @@ -289,7 +289,7 @@ public class DSATest spec); ECPublicKeySpec pubKey = new ECPublicKeySpec( - curve.decodePoint(Hex.decode("025b6dc53bc61a2548ffb0f671472de6c9521a9d2d2534e65abfcbd5fe0c70")), // Q + curve.decodePoint(Hex.decode("045b6dc53bc61a2548ffb0f671472de6c9521a9d2d2534e65abfcbd5fe0c707fd9f1ed2e65f09f6ce0893baf5e8e31e6ae82ea8c3592335be906d38dee")), // Q spec); Signature sgr = Signature.getInstance("ECDSA", "BC"); @@ -341,7 +341,7 @@ public class DSATest ECParameterSpec spec = new ECParameterSpec( curve, - curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + curve.decodePoint(Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307")); // n @@ -350,7 +350,7 @@ public class DSATest spec); ECPublicKeySpec pubKey = new ECPublicKeySpec( - curve.decodePoint(Hex.decode("025b6dc53bc61a2548ffb0f671472de6c9521a9d2d2534e65abfcbd5fe0c70")), // Q + curve.decodePoint(Hex.decode("045b6dc53bc61a2548ffb0f671472de6c9521a9d2d2534e65abfcbd5fe0c707fd9f1ed2e65f09f6ce0893baf5e8e31e6ae82ea8c3592335be906d38dee")), // Q spec); Signature sgr = Signature.getInstance("NONEwithECDSA", "BC"); @@ -627,7 +627,7 @@ public class DSATest ECParameterSpec ecSpec = new ECParameterSpec( curve, - curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + curve.decodePoint(Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307")); // n g.initialize(ecSpec, new SecureRandom()); diff --git a/src/org/bouncycastle/jce/provider/test/DSTU4145Test.java b/src/org/bouncycastle/jce/provider/test/DSTU4145Test.java index a3e1a80..b9aed31 100644 --- a/src/org/bouncycastle/jce/provider/test/DSTU4145Test.java +++ b/src/org/bouncycastle/jce/provider/test/DSTU4145Test.java @@ -62,7 +62,7 @@ public class DSTU4145Test ECParameterSpec spec = new ECParameterSpec( curve, - curve.createPoint(new BigInteger("BE6628EC3E67A91A4E470894FBA72B52C515F8AEE9", 16), new BigInteger("D9DEEDF655CF5412313C11CA566CDC71F4DA57DB45C", 16), false), + curve.createPoint(new BigInteger("BE6628EC3E67A91A4E470894FBA72B52C515F8AEE9", 16), new BigInteger("D9DEEDF655CF5412313C11CA566CDC71F4DA57DB45C", 16)), new BigInteger("800000000000000000000189B4E67606E3825BB2831", 16)); SecureRandom k = new FixedSecureRandom(Hex.decode("00137449348C1249971759D99C252FFE1E14D8B31F00")); @@ -120,7 +120,7 @@ public class DSTU4145Test ECParameterSpec spec = new ECParameterSpec( curve, - curve.createPoint(new BigInteger("BE6628EC3E67A91A4E470894FBA72B52C515F8AEE9", 16), new BigInteger("D9DEEDF655CF5412313C11CA566CDC71F4DA57DB45C", 16), false), + curve.createPoint(new BigInteger("BE6628EC3E67A91A4E470894FBA72B52C515F8AEE9", 16), new BigInteger("D9DEEDF655CF5412313C11CA566CDC71F4DA57DB45C", 16)), new BigInteger("800000000000000000000189B4E67606E3825BB2831", 16)); ECPrivateKeySpec priKey = new ECPrivateKeySpec( @@ -128,7 +128,7 @@ public class DSTU4145Test spec); ECPublicKeySpec pubKey = new ECPublicKeySpec( - curve.createPoint(new BigInteger("22de541d48a75c1c3b8c7c107b2551c5093c6c096e1", 16), new BigInteger("1e5b602efc0269d61e64d97c9193d2788fa05c4b7fd5", 16), false), + curve.createPoint(new BigInteger("22de541d48a75c1c3b8c7c107b2551c5093c6c096e1", 16), new BigInteger("1e5b602efc0269d61e64d97c9193d2788fa05c4b7fd5", 16)), spec); Signature sgr = Signature.getInstance("DSTU4145", "BC"); diff --git a/src/org/bouncycastle/jce/provider/test/ECDSA5Test.java b/src/org/bouncycastle/jce/provider/test/ECDSA5Test.java index 734711a..a2a74cb 100644 --- a/src/org/bouncycastle/jce/provider/test/ECDSA5Test.java +++ b/src/org/bouncycastle/jce/provider/test/ECDSA5Test.java @@ -116,7 +116,7 @@ public class ECDSA5Test ECParameterSpec spec = new ECParameterSpec( curve, - ECPointUtil.decodePoint(curve, Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + ECPointUtil.decodePoint(curve, Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307"), // n 1); // h @@ -126,7 +126,7 @@ public class ECDSA5Test spec); ECPublicKeySpec pubKey = new ECPublicKeySpec( - ECPointUtil.decodePoint(curve, Hex.decode("025b6dc53bc61a2548ffb0f671472de6c9521a9d2d2534e65abfcbd5fe0c70")), // Q + ECPointUtil.decodePoint(curve, Hex.decode("045b6dc53bc61a2548ffb0f671472de6c9521a9d2d2534e65abfcbd5fe0c707fd9f1ed2e65f09f6ce0893baf5e8e31e6ae82ea8c3592335be906d38dee")), // Q spec); Signature sgr = Signature.getInstance("ECDSA", "BC"); @@ -313,7 +313,7 @@ public class ECDSA5Test ECParameterSpec ecSpec = new ECParameterSpec( curve, - ECPointUtil.decodePoint(curve, Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + ECPointUtil.decodePoint(curve, Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307"), // n 1); // h @@ -1022,7 +1022,6 @@ public class ECDSA5Test { testKeyConversion(); testAdaptiveKeyConversion(); - decodeTest(); testECDSA239bitPrime(); testECDSA239bitBinary(); testGeneration(); diff --git a/src/org/bouncycastle/jce/provider/test/ECEncodingTest.java b/src/org/bouncycastle/jce/provider/test/ECEncodingTest.java index 1bd3178..ea21ce9 100644 --- a/src/org/bouncycastle/jce/provider/test/ECEncodingTest.java +++ b/src/org/bouncycastle/jce/provider/test/ECEncodingTest.java @@ -92,8 +92,6 @@ public class ECEncodingTest testParams(ecParams, true); testParams(ecParams, false); - - testPointCompression(); } private void testParams(byte[] ecParameterEncoded, boolean compress) diff --git a/src/org/bouncycastle/jce/provider/test/ECNRTest.java b/src/org/bouncycastle/jce/provider/test/ECNRTest.java index 165faa7..2708ff8 100644 --- a/src/org/bouncycastle/jce/provider/test/ECNRTest.java +++ b/src/org/bouncycastle/jce/provider/test/ECNRTest.java @@ -54,7 +54,7 @@ public class ECNRTest ECParameterSpec spec = new ECParameterSpec( curve, - curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + curve.decodePoint(Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307")); // n @@ -63,7 +63,7 @@ public class ECNRTest spec); ECPublicKeySpec pubKey = new ECPublicKeySpec( - curve.decodePoint(Hex.decode("025b6dc53bc61a2548ffb0f671472de6c9521a9d2d2534e65abfcbd5fe0c70")), // Q + curve.decodePoint(Hex.decode("045b6dc53bc61a2548ffb0f671472de6c9521a9d2d2534e65abfcbd5fe0c707fd9f1ed2e65f09f6ce0893baf5e8e31e6ae82ea8c3592335be906d38dee")), // Q spec); Signature sgr = Signature.getInstance("SHA1withECNR", "BC"); @@ -98,7 +98,7 @@ public class ECNRTest ECParameterSpec spec = new ECParameterSpec( curve, - curve.decodePoint(Hex.decode("03188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012")), // G + curve.decodePoint(Hex.decode("04188da80eb03090f67cbf20eb43a18800f4ff0afd82ff101207192b95ffc8da78631011ed6b24cdd573f977a11e794811")), // G new BigInteger("6277101735386680763835789423176059013767194773182842284081")); // n @@ -107,7 +107,7 @@ public class ECNRTest spec); ECPublicKeySpec pubKey = new ECPublicKeySpec( - curve.decodePoint(Hex.decode("0262B12D60690CDCF330BABAB6E69763B471F994DD702D16A5")), // Q + curve.decodePoint(Hex.decode("0462b12d60690cdcf330babab6e69763b471f994dd702d16a563bf5ec08069705ffff65e5ca5c0d69716dfcb3474373902")), // Q spec); Signature sgr = Signature.getInstance("SHA1withECNR", "BC"); @@ -142,7 +142,7 @@ public class ECNRTest ECParameterSpec spec = new ECParameterSpec( curve, - curve.decodePoint(Hex.decode("0200C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66")), // G + curve.decodePoint(Hex.decode("0400c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")), // G new BigInteger("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409", 16)); // n @@ -151,7 +151,7 @@ public class ECNRTest spec); ECPublicKeySpec pubKey = new ECPublicKeySpec( - curve.decodePoint(Hex.decode("02006BFDD2C9278B63C92D6624F151C9D7A822CC75BD983B17D25D74C26740380022D3D8FAF304781E416175EADF4ED6E2B47142D2454A7AC7801DD803CF44A4D1F0AC")), // Q + curve.decodePoint(Hex.decode("04006bfdd2c9278b63c92d6624f151c9d7a822cc75bd983b17d25d74c26740380022d3d8faf304781e416175eadf4ed6e2b47142d2454a7ac7801dd803cf44a4d1f0ac0005d2e664716a66051daacc160412a86312d4d6eca7d0fc5a0fa16100ff0a8ada1b12b23c63ccc5e2114fbd30ae81919f12486ee4b7789c12c08361a079891ca872")), // Q spec); Signature sgr = Signature.getInstance("SHA512withECNR", "BC"); diff --git a/src/org/bouncycastle/jce/provider/test/IESTest.java b/src/org/bouncycastle/jce/provider/test/IESTest.java index 177ec2e..37e3d26 100644 --- a/src/org/bouncycastle/jce/provider/test/IESTest.java +++ b/src/org/bouncycastle/jce/provider/test/IESTest.java @@ -50,7 +50,7 @@ public class IESTest ECParameterSpec ecSpec = new ECParameterSpec( curve, - curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + curve.decodePoint(Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307")); // n g.initialize(ecSpec, new SecureRandom()); diff --git a/src/org/bouncycastle/jce/provider/test/ImplicitlyCaTest.java b/src/org/bouncycastle/jce/provider/test/ImplicitlyCaTest.java index fa90108..f6d9a31 100644 --- a/src/org/bouncycastle/jce/provider/test/ImplicitlyCaTest.java +++ b/src/org/bouncycastle/jce/provider/test/ImplicitlyCaTest.java @@ -62,7 +62,7 @@ public class ImplicitlyCaTest ECParameterSpec ecSpec = new ECParameterSpec( curve, - curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + curve.decodePoint(Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307")); // n ConfigurableProvider config = (ConfigurableProvider)Security.getProvider("BC"); @@ -96,7 +96,7 @@ public class ImplicitlyCaTest ECParameterSpec ecSpec = new ECParameterSpec( curve, - curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + curve.decodePoint(Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307")); // n ConfigurableProvider config = (ConfigurableProvider)Security.getProvider("BC"); @@ -153,7 +153,7 @@ public class ImplicitlyCaTest java.security.spec.ECParameterSpec ecSpec = new java.security.spec.ECParameterSpec( curve, - ECPointUtil.decodePoint(curve, Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + ECPointUtil.decodePoint(curve, Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307"), // n 1); // h @@ -189,7 +189,7 @@ public class ImplicitlyCaTest java.security.spec.ECParameterSpec ecSpec = new java.security.spec.ECParameterSpec( curve, - ECPointUtil.decodePoint(curve, Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + ECPointUtil.decodePoint(curve, Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307"), // n 1); // h diff --git a/src/org/bouncycastle/jce/provider/test/KeyStoreTest.java b/src/org/bouncycastle/jce/provider/test/KeyStoreTest.java index 4dc6247..e4258a8 100644 --- a/src/org/bouncycastle/jce/provider/test/KeyStoreTest.java +++ b/src/org/bouncycastle/jce/provider/test/KeyStoreTest.java @@ -83,7 +83,7 @@ public class KeyStoreTest ECParameterSpec ecSpec = new ECParameterSpec( curve, - curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + curve.decodePoint(Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307")); // n KeyPairGenerator g = KeyPairGenerator.getInstance("ECDSA", "BC"); diff --git a/src/org/bouncycastle/jce/provider/test/PKCS10CertRequestTest.java b/src/org/bouncycastle/jce/provider/test/PKCS10CertRequestTest.java index 527e5ab..afb3341 100644 --- a/src/org/bouncycastle/jce/provider/test/PKCS10CertRequestTest.java +++ b/src/org/bouncycastle/jce/provider/test/PKCS10CertRequestTest.java @@ -229,7 +229,7 @@ public class PKCS10CertRequestTest ECParameterSpec spec = new ECParameterSpec( curve, - curve.decodePoint(Hex.decode("0200C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66")), // G + curve.decodePoint(Hex.decode("0400c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")), // G new BigInteger("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409", 16)); // n ECPrivateKeySpec privKeySpec = new ECPrivateKeySpec( @@ -237,7 +237,7 @@ public class PKCS10CertRequestTest spec); ECPublicKeySpec pubKeySpec = new ECPublicKeySpec( - curve.decodePoint(Hex.decode("02006BFDD2C9278B63C92D6624F151C9D7A822CC75BD983B17D25D74C26740380022D3D8FAF304781E416175EADF4ED6E2B47142D2454A7AC7801DD803CF44A4D1F0AC")), // Q + curve.decodePoint(Hex.decode("04006bfdd2c9278b63c92d6624f151c9d7a822cc75bd983b17d25d74c26740380022d3d8faf304781e416175eadf4ed6e2b47142d2454a7ac7801dd803cf44a4d1f0ac0005d2e664716a66051daacc160412a86312d4d6eca7d0fc5a0fa16100ff0a8ada1b12b23c63ccc5e2114fbd30ae81919f12486ee4b7789c12c08361a079891ca872")), // Q spec); // @@ -503,7 +503,7 @@ public class PKCS10CertRequestTest ECParameterSpec ecSpec = new ECParameterSpec( curve, - curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + curve.decodePoint(Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307")); // n g.initialize(ecSpec, new SecureRandom()); diff --git a/src/org/bouncycastle/math/ec/ECCurve.java b/src/org/bouncycastle/math/ec/ECCurve.java index 7f3197b..fc4247e 100644 --- a/src/org/bouncycastle/math/ec/ECCurve.java +++ b/src/org/bouncycastle/math/ec/ECCurve.java @@ -121,32 +121,9 @@ public abstract class ECCurve return p; } - /** - * @deprecated per-point compression property will be removed, use {@link #validatePoint(BigInteger, BigInteger)} - * and refer {@link ECPoint#getEncoded(boolean)} - */ - public ECPoint validatePoint(BigInteger x, BigInteger y, boolean withCompression) - { - ECPoint p = createPoint(x, y, withCompression); - if (!p.isValid()) - { - throw new IllegalArgumentException("Invalid point coordinates"); - } - return p; - } - public ECPoint createPoint(BigInteger x, BigInteger y) { - return createPoint(x, y, false); - } - - /** - * @deprecated per-point compression property will be removed, use {@link #createPoint(BigInteger, BigInteger)} - * and refer {@link ECPoint#getEncoded(boolean)} - */ - public ECPoint createPoint(BigInteger x, BigInteger y, boolean withCompression) - { - return createRawPoint(fromBigInteger(x), fromBigInteger(y), withCompression); + return createRawPoint(fromBigInteger(x), fromBigInteger(y), false); } protected abstract ECCurve cloneCurve(); @@ -220,7 +197,7 @@ public abstract class ECCurve // TODO Default behaviour could be improved if the two curves have the same coordinate system by copying any Z coordinates. p = p.normalize(); - return validatePoint(p.getXCoord().toBigInteger(), p.getYCoord().toBigInteger(), p.withCompression); + return validatePoint(p.getXCoord().toBigInteger(), p.getYCoord().toBigInteger()); } /** @@ -378,25 +355,6 @@ public abstract class ECCurve p = getInfinity(); break; } - case 0x02: // compressed - case 0x03: // compressed - { - if (encoded.length != (expectedLength + 1)) - { - throw new IllegalArgumentException("Incorrect length for compressed encoding"); - } - - int yTilde = type & 1; - BigInteger X = BigIntegers.fromUnsignedByteArray(encoded, 1, expectedLength); - - p = decompressPoint(yTilde, X); - if (!p.satisfiesCofactor()) - { - throw new IllegalArgumentException("Invalid point"); - } - - break; - } case 0x04: // uncompressed { if (encoded.length != (2 * expectedLength + 1)) @@ -618,12 +576,12 @@ public abstract class ECCurve protected ECPoint createRawPoint(ECFieldElement x, ECFieldElement y, boolean withCompression) { - return new ECPoint.Fp(this, x, y, withCompression); + return new ECPoint.Fp(this, x, y); } protected ECPoint createRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, boolean withCompression) { - return new ECPoint.Fp(this, x, y, zs, withCompression); + return new ECPoint.Fp(this, x, y, zs); } public ECPoint importPoint(ECPoint p) @@ -638,8 +596,7 @@ public abstract class ECCurve return new ECPoint.Fp(this, fromBigInteger(p.x.toBigInteger()), fromBigInteger(p.y.toBigInteger()), - new ECFieldElement[]{ fromBigInteger(p.zs[0].toBigInteger()) }, - p.withCompression); + new ECFieldElement[]{ fromBigInteger(p.zs[0].toBigInteger()) }); default: break; } @@ -708,7 +665,7 @@ public abstract class ECCurve return x != null && x.signum() >= 0 && x.bitLength() <= this.getFieldSize(); } - public ECPoint createPoint(BigInteger x, BigInteger y, boolean withCompression) + public ECPoint createPoint(BigInteger x, BigInteger y) { ECFieldElement X = this.fromBigInteger(x), Y = this.fromBigInteger(y); @@ -750,7 +707,7 @@ public abstract class ECCurve } } - return this.createRawPoint(X, Y, withCompression); + return this.createRawPoint(X, Y, false); } /** @@ -1102,12 +1059,12 @@ public abstract class ECCurve protected ECPoint createRawPoint(ECFieldElement x, ECFieldElement y, boolean withCompression) { - return new ECPoint.F2m(this, x, y, withCompression); + return new ECPoint.F2m(this, x, y); } protected ECPoint createRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, boolean withCompression) { - return new ECPoint.F2m(this, x, y, zs, withCompression); + return new ECPoint.F2m(this, x, y, zs); } public ECPoint getInfinity() diff --git a/src/org/bouncycastle/math/ec/ECPoint.java b/src/org/bouncycastle/math/ec/ECPoint.java index 0ea5026..bdbacce 100644 --- a/src/org/bouncycastle/math/ec/ECPoint.java +++ b/src/org/bouncycastle/math/ec/ECPoint.java @@ -91,33 +91,6 @@ public abstract class ECPoint } /** - * Normalizes this point, and then returns the affine x-coordinate. - * - * Note: normalization can be expensive, this method is deprecated in favour - * of caller-controlled normalization. - * - * @deprecated Use getAffineXCoord(), or normalize() and getXCoord(), instead - */ - public ECFieldElement getX() - { - return normalize().getXCoord(); - } - - - /** - * Normalizes this point, and then returns the affine y-coordinate. - * - * Note: normalization can be expensive, this method is deprecated in favour - * of caller-controlled normalization. - * - * @deprecated Use getAffineYCoord(), or normalize() and getYCoord(), instead - */ - public ECFieldElement getY() - { - return normalize().getYCoord(); - } - - /** * Returns the affine x-coordinate after checking that this point is normalized. * * @return The affine x-coordinate of this point @@ -287,14 +260,6 @@ public abstract class ECPoint return x == null || y == null || (zs.length > 0 && zs[0].isZero()); } - /** - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(boolean)} - */ - public boolean isCompressed() - { - return this.withCompression; - } - public boolean isValid() { if (isInfinity()) @@ -439,14 +404,6 @@ public abstract class ECPoint } /** - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(boolean)} - */ - public byte[] getEncoded() - { - return getEncoded(this.withCompression); - } - - /** * Get an encoding of the point value, optionally in compressed format. * * @param compressed whether to generate a compressed point encoding. @@ -463,14 +420,6 @@ public abstract class ECPoint byte[] X = normed.getXCoord().getEncoded(); - if (compressed) - { - byte[] PO = new byte[X.length + 1]; - PO[0] = (byte)(normed.getCompressionYTilde() ? 0x03 : 0x02); - System.arraycopy(X, 0, PO, 1, X.length); - return PO; - } - byte[] Y = normed.getYCoord().getEncoded(); byte[] PO = new byte[X.length + Y.length + 1]; @@ -612,36 +561,17 @@ public abstract class ECPoint */ public Fp(ECCurve curve, ECFieldElement x, ECFieldElement y) { - this(curve, x, y, false); - } - - /** - * 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 - * - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(boolean)} - */ - public Fp(ECCurve curve, ECFieldElement x, ECFieldElement y, boolean withCompression) - { super(curve, x, y); if ((x == null) != (y == null)) { throw new IllegalArgumentException("Exactly one of the field elements is null"); } - - this.withCompression = withCompression; } - Fp(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, boolean withCompression) + Fp(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { super(curve, x, y, zs); - - this.withCompression = withCompression; } protected ECPoint detach() @@ -703,7 +633,7 @@ public abstract class ECPoint ECFieldElement X3 = gamma.square().subtract(X1).subtract(X2); ECFieldElement Y3 = gamma.multiply(X1.subtract(X3)).subtract(Y1); - return new ECPoint.Fp(curve, X3, Y3, this.withCompression); + return new ECPoint.Fp(curve, X3, Y3); } case ECCurve.COORD_HOMOGENEOUS: @@ -745,7 +675,7 @@ public abstract class ECPoint ECFieldElement Y3 = vSquaredV2.subtract(A).multiplyMinusProduct(u, u2, vCubed); ECFieldElement Z3 = vCubed.multiply(w); - return new ECPoint.Fp(curve, X3, Y3, new ECFieldElement[]{ Z3 }, this.withCompression); + return new ECPoint.Fp(curve, X3, Y3, new ECFieldElement[]{ Z3 }); } case ECCurve.COORD_JACOBIAN: @@ -868,7 +798,7 @@ public abstract class ECPoint zs = new ECFieldElement[]{ Z3 }; } - return new ECPoint.Fp(curve, X3, Y3, zs, this.withCompression); + return new ECPoint.Fp(curve, X3, Y3, zs); } default: @@ -907,7 +837,7 @@ public abstract class ECPoint ECFieldElement X3 = gamma.square().subtract(two(X1)); ECFieldElement Y3 = gamma.multiply(X1.subtract(X3)).subtract(Y1); - return new ECPoint.Fp(curve, X3, Y3, this.withCompression); + return new ECPoint.Fp(curve, X3, Y3); } case ECCurve.COORD_HOMOGENEOUS: @@ -937,7 +867,7 @@ public abstract class ECPoint ECFieldElement _4sSquared = Z1IsOne ? two(_2t) : _2s.square(); ECFieldElement Z3 = two(_4sSquared).multiply(s); - return new ECPoint.Fp(curve, X3, Y3, new ECFieldElement[]{ Z3 }, this.withCompression); + return new ECPoint.Fp(curve, X3, Y3, new ECFieldElement[]{ Z3 }); } case ECCurve.COORD_JACOBIAN: @@ -996,7 +926,7 @@ public abstract class ECPoint // Alternative calculation of Z3 using fast square // ECFieldElement Z3 = doubleProductFromSquares(Y1, Z1, Y1Squared, Z1Squared); - return new ECPoint.Fp(curve, X3, Y3, new ECFieldElement[]{ Z3 }, this.withCompression); + return new ECPoint.Fp(curve, X3, Y3, new ECFieldElement[]{ Z3 }); } case ECCurve.COORD_JACOBIAN_MODIFIED: @@ -1075,7 +1005,7 @@ public abstract class ECPoint ECFieldElement X4 = (L2.subtract(L1)).multiply(L1.add(L2)).add(X2); ECFieldElement Y4 = (X1.subtract(X4)).multiply(L2).subtract(Y1); - return new ECPoint.Fp(curve, X4, Y4, this.withCompression); + return new ECPoint.Fp(curve, X4, Y4); } case ECCurve.COORD_JACOBIAN_MODIFIED: { @@ -1128,7 +1058,7 @@ public abstract class ECPoint ECFieldElement X4 = (L2.subtract(L1)).multiply(L1.add(L2)).add(X1); ECFieldElement Y4 = (X1.subtract(X4)).multiply(L2).subtract(Y1); - return new ECPoint.Fp(curve, X4, Y4, this.withCompression); + return new ECPoint.Fp(curve, X4, Y4); } case ECCurve.COORD_JACOBIAN_MODIFIED: { @@ -1224,15 +1154,15 @@ public abstract class ECPoint { case ECCurve.COORD_AFFINE: ECFieldElement zInv = Z1.invert(), zInv2 = zInv.square(), zInv3 = zInv2.multiply(zInv); - return new Fp(curve, X1.multiply(zInv2), Y1.multiply(zInv3), this.withCompression); + return new Fp(curve, X1.multiply(zInv2), Y1.multiply(zInv3)); case ECCurve.COORD_HOMOGENEOUS: X1 = X1.multiply(Z1); Z1 = Z1.multiply(Z1.square()); - return new Fp(curve, X1, Y1, new ECFieldElement[]{ Z1 }, this.withCompression); + return new Fp(curve, X1, Y1, new ECFieldElement[]{ Z1 }); case ECCurve.COORD_JACOBIAN: - return new Fp(curve, X1, Y1, new ECFieldElement[]{ Z1 }, this.withCompression); + return new Fp(curve, X1, Y1, new ECFieldElement[]{ Z1 }); case ECCurve.COORD_JACOBIAN_MODIFIED: - return new Fp(curve, X1, Y1, new ECFieldElement[]{ Z1, W1 }, this.withCompression); + return new Fp(curve, X1, Y1, new ECFieldElement[]{ Z1, W1 }); default: throw new IllegalStateException("unsupported coordinate system"); } @@ -1280,10 +1210,10 @@ public abstract class ECPoint if (ECCurve.COORD_AFFINE != coord) { - return new ECPoint.Fp(curve, this.x, this.y.negate(), this.zs, this.withCompression); + return new ECPoint.Fp(curve, this.x, this.y.negate(), this.zs); } - return new ECPoint.Fp(curve, this.x, this.y.negate(), this.withCompression); + return new ECPoint.Fp(curve, this.x, this.y.negate()); } protected ECFieldElement calculateJacobianModifiedW(ECFieldElement Z, ECFieldElement ZSquared) @@ -1339,7 +1269,7 @@ public abstract class ECPoint ECFieldElement W3 = calculateW ? two(_8T.multiply(W1)) : null; ECFieldElement Z3 = Z1.isOne() ? _2Y1 : _2Y1.multiply(Z1); - return new ECPoint.Fp(this.getCurve(), X3, Y3, new ECFieldElement[]{ Z3, W3 }, this.withCompression); + return new ECPoint.Fp(this.getCurve(), X3, Y3, new ECFieldElement[]{ Z3, W3 }); } } @@ -1585,19 +1515,6 @@ public abstract class ECPoint */ public F2m(ECCurve curve, ECFieldElement x, ECFieldElement y) { - this(curve, x, y, false); - } - - /** - * @param curve base curve - * @param x x point - * @param y y point - * @param withCompression true if encode with point compression. - * - * @deprecated per-point compression property will be removed, refer {@link #getEncoded(boolean)} - */ - public F2m(ECCurve curve, ECFieldElement x, ECFieldElement y, boolean withCompression) - { super(curve, x, y); if ((x == null) != (y == null)) @@ -1617,17 +1534,13 @@ public abstract class ECPoint } } - this.withCompression = withCompression; - // checkCurveEquation(); } - - F2m(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, boolean withCompression) + + F2m(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs) { super(curve, x, y, zs); - this.withCompression = withCompression; - // checkCurveEquation(); } @@ -1736,7 +1649,7 @@ public abstract class ECPoint ECFieldElement X3 = L.square().add(L).add(dx).add(curve.getA()); ECFieldElement Y3 = L.multiply(X1.add(X3)).add(X3).add(Y1); - return new ECPoint.F2m(curve, X3, Y3, this.withCompression); + return new ECPoint.F2m(curve, X3, Y3); } case ECCurve.COORD_HOMOGENEOUS: { @@ -1773,7 +1686,7 @@ public abstract class ECPoint ECFieldElement Y3 = U.multiplyPlusProduct(X1, V, Y1).multiplyPlusProduct(VSqZ2, uv, A); ECFieldElement Z3 = VCu.multiply(W); - return new ECPoint.F2m(curve, X3, Y3, new ECFieldElement[]{ Z3 }, this.withCompression); + return new ECPoint.F2m(curve, X3, Y3, new ECFieldElement[]{ Z3 }); } case ECCurve.COORD_LAMBDA_PROJECTIVE: { @@ -1833,7 +1746,7 @@ public abstract class ECPoint X3 = L.square().add(L).add(X1).add(curve.getA()); if (X3.isZero()) { - return new ECPoint.F2m(curve, X3, curve.getB().sqrt(), this.withCompression); + return new ECPoint.F2m(curve, X3, curve.getB().sqrt()); } ECFieldElement Y3 = L.multiply(X1.add(X3)).add(X3).add(Y1); @@ -1850,7 +1763,7 @@ public abstract class ECPoint X3 = AU1.multiply(AU2); if (X3.isZero()) { - return new ECPoint.F2m(curve, X3, curve.getB().sqrt(), this.withCompression); + return new ECPoint.F2m(curve, X3, curve.getB().sqrt()); } ECFieldElement ABZ2 = A.multiply(B); @@ -1868,7 +1781,7 @@ public abstract class ECPoint } } - return new ECPoint.F2m(curve, X3, L3, new ECFieldElement[]{ Z3 }, this.withCompression); + return new ECPoint.F2m(curve, X3, L3, new ECFieldElement[]{ Z3 }); } default: { @@ -1906,7 +1819,7 @@ public abstract class ECPoint ECFieldElement X3 = L1.square().add(L1).add(curve.getA()); ECFieldElement Y3 = X1.squarePlusProduct(X3, L1.addOne()); - return new ECPoint.F2m(curve, X3, Y3, this.withCompression); + return new ECPoint.F2m(curve, X3, Y3); } case ECCurve.COORD_HOMOGENEOUS: { @@ -1927,7 +1840,7 @@ public abstract class ECPoint ECFieldElement Y3 = X1Sq.square().multiplyPlusProduct(V, h, sv); ECFieldElement Z3 = V.multiply(vSquared); - return new ECPoint.F2m(curve, X3, Y3, new ECFieldElement[]{ Z3 }, this.withCompression); + return new ECPoint.F2m(curve, X3, Y3, new ECFieldElement[]{ Z3 }); } case ECCurve.COORD_LAMBDA_PROJECTIVE: { @@ -1941,7 +1854,7 @@ public abstract class ECPoint ECFieldElement T = L1.square().add(L1Z1).add(aZ1Sq); if (T.isZero()) { - return new ECPoint.F2m(curve, T, curve.getB().sqrt(), withCompression); + return new ECPoint.F2m(curve, T, curve.getB().sqrt()); } ECFieldElement X3 = T.square(); @@ -1978,7 +1891,7 @@ public abstract class ECPoint L3 = X1Z1.squarePlusProduct(T, L1Z1).add(X3).add(Z3); } - return new ECPoint.F2m(curve, X3, L3, new ECFieldElement[]{ Z3 }, this.withCompression); + return new ECPoint.F2m(curve, X3, L3, new ECFieldElement[]{ Z3 }); } default: { @@ -2046,14 +1959,14 @@ public abstract class ECPoint if (A.isZero()) { - return new ECPoint.F2m(curve, A, curve.getB().sqrt(), withCompression); + return new ECPoint.F2m(curve, A, curve.getB().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 ECPoint.F2m(curve, X3, L3, new ECFieldElement[]{ Z3 }, this.withCompression); + return new ECPoint.F2m(curve, X3, L3, new ECFieldElement[]{ Z3 }); } default: { @@ -2080,23 +1993,23 @@ public abstract class ECPoint case ECCurve.COORD_AFFINE: { ECFieldElement Y = this.y; - return new ECPoint.F2m(curve, X, Y.add(X), this.withCompression); + return new ECPoint.F2m(curve, X, Y.add(X)); } case ECCurve.COORD_HOMOGENEOUS: { ECFieldElement Y = this.y, Z = this.zs[0]; - return new ECPoint.F2m(curve, X, Y.add(X), new ECFieldElement[]{ Z }, this.withCompression); + return new ECPoint.F2m(curve, X, Y.add(X), new ECFieldElement[]{ Z }); } case ECCurve.COORD_LAMBDA_AFFINE: { ECFieldElement L = this.y; - return new ECPoint.F2m(curve, X, L.addOne(), this.withCompression); + return new ECPoint.F2m(curve, X, L.addOne()); } case ECCurve.COORD_LAMBDA_PROJECTIVE: { // L is actually Lambda (X + Y/X) here ECFieldElement L = this.y, Z = this.zs[0]; - return new ECPoint.F2m(curve, X, L.add(Z), new ECFieldElement[]{ Z }, this.withCompression); + return new ECPoint.F2m(curve, X, L.add(Z), new ECFieldElement[]{ Z }); } default: {