diff options
author | David Hook <dgh@bouncycastle.org> | 2019-01-14 16:43:22 +1100 |
---|---|---|
committer | David Hook <dgh@bouncycastle.org> | 2019-01-14 16:43:22 +1100 |
commit | 839879ee7ad82df31adc2a12cf237760d3fdfda5 (patch) | |
tree | 84f82721ae3f9e2c45099668784f45dd514eaaa2 /crypto | |
parent | Added ECGOST3410_2012Signer (diff) | |
download | BouncyCastle.NET-ed25519-839879ee7ad82df31adc2a12cf237760d3fdfda5.tar.xz |
minor tweaks
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/src/crypto/signers/EcGost3410_2012Signer.cs | 16 | ||||
-rw-r--r-- | crypto/test/src/crypto/test/GOST3410Test.cs | 18 |
2 files changed, 18 insertions, 16 deletions
diff --git a/crypto/src/crypto/signers/EcGost3410_2012Signer.cs b/crypto/src/crypto/signers/EcGost3410_2012Signer.cs index cd50916dd..e7174ace6 100644 --- a/crypto/src/crypto/signers/EcGost3410_2012Signer.cs +++ b/crypto/src/crypto/signers/EcGost3410_2012Signer.cs @@ -1,7 +1,7 @@ using Org.BouncyCastle.Math; using System; using System.IO; -using NUnit.Core; + using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Math.EC; using Org.BouncyCastle.Math.EC.Multiplier; @@ -53,7 +53,7 @@ namespace Org.BouncyCastle.Crypto.Signers { if (!forSigning) { - throw new InvalidOperationException("not initialised for signing."); + throw new InvalidOperationException("not initialized for signing"); } byte[] mRev = new byte[message.Length]; // conversion is little-endian @@ -79,15 +79,18 @@ namespace Org.BouncyCastle.Crypto.Signers do { k = BigIntegers.CreateRandomBigInteger(n.BitLength, secureRandom); - } while (k.Equals(BigInteger.Zero)); // ECConstants.ZERO)); + } + while (k.Equals(BigInteger.Zero)); // ECConstants.ZERO)); ECPoint p = basePointMultiplier.Multiply(ec.G, k).Normalize(); r = p.AffineXCoord.ToBigInteger().Mod(n); - } while (r.Equals(BigInteger.Zero)); // ECConstants.ZERO)); + } + while (r.Equals(BigInteger.Zero)); // ECConstants.ZERO)); s = (k.Multiply(e)).Add(d.Multiply(r)).Mod(n); - } while (s.Equals(BigInteger.Zero)); // ECConstants.ZERO)); + } + while (s.Equals(BigInteger.Zero)); // ECConstants.ZERO)); return new BigInteger[] { r, s }; } @@ -97,7 +100,7 @@ namespace Org.BouncyCastle.Crypto.Signers { if (forSigning) { - throw new InvalidOperationException("not initialised for verification."); + throw new InvalidOperationException("not initialized for verification"); } @@ -146,6 +149,5 @@ namespace Org.BouncyCastle.Crypto.Signers { return new FixedPointCombMultiplier(); } - } } \ No newline at end of file diff --git a/crypto/test/src/crypto/test/GOST3410Test.cs b/crypto/test/src/crypto/test/GOST3410Test.cs index f54662770..1369d3506 100644 --- a/crypto/test/src/crypto/test/GOST3410Test.cs +++ b/crypto/test/src/crypto/test/GOST3410Test.cs @@ -1553,15 +1553,15 @@ namespace Org.BouncyCastle.Crypto.Tests { new Gost3410_TEST1_512(), new Gost3410_TEST2_512(), -// new Gost3410_TEST1_1024(), -// new Gost3410_TEST2_1024(), -// new Gost3410_AParam(), -// new Gost3410_BParam(), -// new Gost3410_CParam(), -// new Gost3410_DParam(), -// new Gost3410_AExParam(), -// new Gost3410_BExParam(), -// new Gost3410_CExParam() + new Gost3410_TEST1_1024(), + new Gost3410_TEST2_1024(), + new Gost3410_AParam(), + new Gost3410_BParam(), + new Gost3410_CParam(), + new Gost3410_DParam(), + new Gost3410_AExParam(), + new Gost3410_BExParam(), + new Gost3410_CExParam() }; public string Name |