From aca10f3c38a70188b4caa29b1ca32b2dd04e16bc Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Tue, 10 Jul 2018 23:21:16 +0700 Subject: EC-related updates from bc-java --- crypto/test/src/security/test/TestEncodings.cs | 31 +++++++++++-------------- crypto/test/src/security/test/TestSignerUtil.cs | 16 ++++++------- 2 files changed, 20 insertions(+), 27 deletions(-) (limited to 'crypto/test/src/security') diff --git a/crypto/test/src/security/test/TestEncodings.cs b/crypto/test/src/security/test/TestEncodings.cs index 557d2dc51..a70d5b5b7 100644 --- a/crypto/test/src/security/test/TestEncodings.cs +++ b/crypto/test/src/security/test/TestEncodings.cs @@ -32,24 +32,19 @@ namespace Org.BouncyCastle.Security.Tests BigInteger ECPubQY = new BigInteger(Base64.Decode("JrlJfxu3WGhqwtL/55BOs/wsUeiDFsvXcGhB8DGx")); BigInteger ECPrivD = new BigInteger(Base64.Decode("GYQmd/NF1B+He1iMkWt3by2Az6Eu07t0ynJ4YCAo")); - FpCurve curve = new FpCurve( - new BigInteger("883423532389192164791648750360308885314476597252960362792450860609699839"), // q - new BigInteger("7fffffffffffffffffffffff7fffffffffff8000000000007ffffffffffc", 16), // a - new BigInteger("6b016c3bdcf18941d0d654921475ca71a9db2fb27d1d37796185c2942c0a", 16)); // b - - ECDomainParameters ecDomain = - new ECDomainParameters( - curve, - new FpPoint(curve, - curve.FromBigInteger(ECParraGX), - curve.FromBigInteger(ECParraGY)), - ECParraN); - - ECPublicKeyParameters ecPub = new ECPublicKeyParameters( - new FpPoint( - curve, - curve.FromBigInteger(ECPubQX), - curve.FromBigInteger(ECPubQY)), + FpCurve curve = new FpCurve( + new BigInteger("883423532389192164791648750360308885314476597252960362792450860609699839"), // q + new BigInteger("7fffffffffffffffffffffff7fffffffffff8000000000007ffffffffffc", 16), // a + new BigInteger("6b016c3bdcf18941d0d654921475ca71a9db2fb27d1d37796185c2942c0a", 16), // b + ECParraN, ECParraH); + + ECDomainParameters ecDomain = new ECDomainParameters( + curve, + curve.ValidatePoint(ECParraGX, ECParraGY), + ECParraN, ECParraH); + + ECPublicKeyParameters ecPub = new ECPublicKeyParameters( + curve.ValidatePoint(ECPubQX, ECPubQY), ecDomain); ECPrivateKeyParameters ecPriv = new ECPrivateKeyParameters(ECPrivD, ecDomain); diff --git a/crypto/test/src/security/test/TestSignerUtil.cs b/crypto/test/src/security/test/TestSignerUtil.cs index 18b856e3f..f2ee4b048 100644 --- a/crypto/test/src/security/test/TestSignerUtil.cs +++ b/crypto/test/src/security/test/TestSignerUtil.cs @@ -56,18 +56,16 @@ namespace Org.BouncyCastle.Security.Tests FpCurve curve = new FpCurve( new BigInteger("883423532389192164791648750360308885314476597252960362792450860609699839"), // q new BigInteger("7fffffffffffffffffffffff7fffffffffff8000000000007ffffffffffc", 16), // a - new BigInteger("6b016c3bdcf18941d0d654921475ca71a9db2fb27d1d37796185c2942c0a", 16)); // b + new BigInteger("6b016c3bdcf18941d0d654921475ca71a9db2fb27d1d37796185c2942c0a", 16), // b + ECParraN, ECParraH); - ECDomainParameters ecDomain = new ECDomainParameters(curve, - new FpPoint(curve, - curve.FromBigInteger(ECParraGX), - curve.FromBigInteger(ECParraGY)), - ECParraN); + ECDomainParameters ecDomain = new ECDomainParameters( + curve, + curve.ValidatePoint(ECParraGX, ECParraGY), + ECParraN, ECParraH); ECPublicKeyParameters ecPub = new ECPublicKeyParameters( - new FpPoint(curve, - curve.FromBigInteger(ECPubQX), - curve.FromBigInteger(ECPubQY)), + curve.ValidatePoint(ECPubQX, ECPubQY), ecDomain); ECPrivateKeyParameters ecPriv = new ECPrivateKeyParameters(ECPrivD, ecDomain); -- cgit 1.4.1