diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-24 20:37:41 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-24 20:37:41 +0700 |
commit | 110f936da13a1639a83edc512c5c104d2f5694a7 (patch) | |
tree | 6edf3f33b1b173348ccf2dfa639fe03979d336c3 /crypto/test | |
parent | Remove bridging version of Curve25519 (diff) | |
download | BouncyCastle.NET-ed25519-110f936da13a1639a83edc512c5c104d2f5694a7.tar.xz |
Update EC curve registry classes
Diffstat (limited to 'crypto/test')
-rw-r--r-- | crypto/test/src/crypto/test/ECGOST3410_2012Test.cs | 8 | ||||
-rw-r--r-- | crypto/test/src/math/ec/test/ECPointPerformanceTest.cs | 18 | ||||
-rw-r--r-- | crypto/test/src/math/ec/test/ECPointTest.cs | 9 |
3 files changed, 16 insertions, 19 deletions
diff --git a/crypto/test/src/crypto/test/ECGOST3410_2012Test.cs b/crypto/test/src/crypto/test/ECGOST3410_2012Test.cs index 0e7e90611..7e0a84cbe 100644 --- a/crypto/test/src/crypto/test/ECGOST3410_2012Test.cs +++ b/crypto/test/src/crypto/test/ECGOST3410_2012Test.cs @@ -30,7 +30,7 @@ namespace Org.BouncyCastle.Crypto.Tests public SimpleTestResult EncodeRecodePublicKey() { DerObjectIdentifier oid = ECGost3410NamedCurves.GetOid("Tc26-Gost-3410-12-512-paramSetA"); - ECNamedDomainParameters ecp = new ECNamedDomainParameters(oid, ECGost3410NamedCurves.GetByOidX9(oid)); + ECNamedDomainParameters ecp = new ECNamedDomainParameters(oid, ECGost3410NamedCurves.GetByOid(oid)); ECGost3410Parameters gostParams = new ECGost3410Parameters(ecp, oid, RosstandartObjectIdentifiers.id_tc26_gost_3411_12_512, null); ECKeyGenerationParameters paramameters = new ECKeyGenerationParameters(gostParams, new SecureRandom()); ECKeyPairGenerator engine = new ECKeyPairGenerator(); @@ -118,7 +118,7 @@ namespace Org.BouncyCastle.Crypto.Tests private SimpleTestResult EncodeRecodePrivateKey() { DerObjectIdentifier oid = ECGost3410NamedCurves.GetOid("Tc26-Gost-3410-12-512-paramSetA"); - ECNamedDomainParameters ecp = new ECNamedDomainParameters(oid, ECGost3410NamedCurves.GetByOidX9(oid)); + ECNamedDomainParameters ecp = new ECNamedDomainParameters(oid, ECGost3410NamedCurves.GetByOid(oid)); ECGost3410Parameters gostParams = new ECGost3410Parameters(ecp, oid, RosstandartObjectIdentifiers.id_tc26_gost_3411_12_512, null); ECKeyGenerationParameters parameters = new ECKeyGenerationParameters(gostParams, new SecureRandom()); ECKeyPairGenerator engine = new ECKeyPairGenerator(); @@ -338,7 +338,7 @@ namespace Org.BouncyCastle.Crypto.Tests public SimpleTestResult EncodeDecodePrivateLW(string oidStr, DerObjectIdentifier digest) { DerObjectIdentifier oid = ECGost3410NamedCurves.GetOid(oidStr); - ECNamedDomainParameters ecp = new ECNamedDomainParameters(oid, ECGost3410NamedCurves.GetByOidX9(oid)); + ECNamedDomainParameters ecp = new ECNamedDomainParameters(oid, ECGost3410NamedCurves.GetByOid(oid)); ECGost3410Parameters gostParams = new ECGost3410Parameters(ecp, oid, digest, null); ECKeyGenerationParameters parameters = new ECKeyGenerationParameters(gostParams, new SecureRandom()); ECKeyPairGenerator engine = new ECKeyPairGenerator(); @@ -421,7 +421,7 @@ namespace Org.BouncyCastle.Crypto.Tests public SimpleTestResult EncodeDecodePublicLW(string oidStr, DerObjectIdentifier digest) { DerObjectIdentifier oid = ECGost3410NamedCurves.GetOid(oidStr); - ECNamedDomainParameters ecp = new ECNamedDomainParameters(oid, ECGost3410NamedCurves.GetByOidX9(oid)); + ECNamedDomainParameters ecp = new ECNamedDomainParameters(oid, ECGost3410NamedCurves.GetByOid(oid)); ECGost3410Parameters gostParams = new ECGost3410Parameters(ecp, oid, digest, null); ECKeyGenerationParameters parameters = new ECKeyGenerationParameters(gostParams, new SecureRandom()); ECKeyPairGenerator engine = new ECKeyPairGenerator(); diff --git a/crypto/test/src/math/ec/test/ECPointPerformanceTest.cs b/crypto/test/src/math/ec/test/ECPointPerformanceTest.cs index e36947b11..059416427 100644 --- a/crypto/test/src/math/ec/test/ECPointPerformanceTest.cs +++ b/crypto/test/src/math/ec/test/ECPointPerformanceTest.cs @@ -1,17 +1,13 @@ using System; -using System.Collections; +using System.Collections.Generic; using System.Text; using NUnit.Framework; using Org.BouncyCastle.Asn1; -using Org.BouncyCastle.Asn1.Sec; using Org.BouncyCastle.Asn1.X9; using Org.BouncyCastle.Crypto.EC; -using Org.BouncyCastle.Math; -using Org.BouncyCastle.Math.EC; using Org.BouncyCastle.Security; -using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.Collections; using Org.BouncyCastle.Utilities.Date; @@ -98,6 +94,8 @@ namespace Org.BouncyCastle.Math.EC.Tests Console.WriteLine(sb.ToString()); } } + + Console.Out.Flush(); } private double RandMult(SecureRandom random, ECPoint g, BigInteger n) @@ -175,12 +173,12 @@ namespace Org.BouncyCastle.Math.EC.Tests [Test, Explicit] public void TestMultiply() { - ArrayList nameList = new ArrayList(); - CollectionUtilities.AddRange(nameList, ECNamedCurveTable.Names); - CollectionUtilities.AddRange(nameList, CustomNamedCurves.Names); + var names = new List<string>(); + names.AddRange(ECNamedCurveTable.Names); + names.AddRange(CustomNamedCurves.Names); + + names.Sort(); - string[] names = (string[])nameList.ToArray(typeof(string)); - Array.Sort(names); ISet oids = new HashSet(); foreach (string name in names) { diff --git a/crypto/test/src/math/ec/test/ECPointTest.cs b/crypto/test/src/math/ec/test/ECPointTest.cs index f3fc6e592..4e3fc5832 100644 --- a/crypto/test/src/math/ec/test/ECPointTest.cs +++ b/crypto/test/src/math/ec/test/ECPointTest.cs @@ -1,11 +1,10 @@ using System; -using System.Collections; +using System.Collections.Generic; using NUnit.Framework; using Org.BouncyCastle.Asn1.X9; using Org.BouncyCastle.Crypto.EC; -using Org.BouncyCastle.Math.EC.Multiplier; using Org.BouncyCastle.Security; using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.Collections; @@ -535,9 +534,9 @@ namespace Org.BouncyCastle.Math.EC.Tests [Test] public void TestAddSubtractMultiplyTwiceEncoding() { - ArrayList names = new ArrayList(); - CollectionUtilities.AddRange(names, ECNamedCurveTable.Names); - CollectionUtilities.AddRange(names, CustomNamedCurves.Names); + var names = new List<string>(); + names.AddRange(ECNamedCurveTable.Names); + names.AddRange(CustomNamedCurves.Names); ISet uniqNames = new HashSet(names); |