From d90506bde1ced221486cb3da0a749fc4999f489c Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Sat, 14 Nov 2015 21:24:04 +0700 Subject: Only initialise static data once --- crypto/test/src/crypto/test/NaccacheSternTest.cs | 32 ++++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/crypto/test/src/crypto/test/NaccacheSternTest.cs b/crypto/test/src/crypto/test/NaccacheSternTest.cs index faa845059..4fa256f12 100644 --- a/crypto/test/src/crypto/test/NaccacheSternTest.cs +++ b/crypto/test/src/crypto/test/NaccacheSternTest.cs @@ -37,12 +37,6 @@ namespace Org.BouncyCastle.Crypto.Tests static readonly NaccacheSternEngine cryptEng = new NaccacheSternEngine(); static readonly NaccacheSternEngine decryptEng = new NaccacheSternEngine(); - static NaccacheSternTest() - { - cryptEng.Debug = debug; - decryptEng.Debug = debug; - } - // Values from NaccacheStern paper static readonly BigInteger a = BigInteger.ValueOf(101); static readonly BigInteger u1 = BigInteger.ValueOf(3); @@ -82,6 +76,22 @@ namespace Org.BouncyCastle.Crypto.Tests // static readonly string edgeInput = "ff6f77206973207468652074696d6520666f7220616c6c20676f6f64206d656e"; + static NaccacheSternTest() + { + cryptEng.Debug = debug; + decryptEng.Debug = debug; + + // First the Parameters from the NaccacheStern Paper + // (see http://www.gemplus.com/smart/rd/publications/pdf/NS98pkcs.pdf ) + + smallPrimes.Add(u1); + smallPrimes.Add(u2); + smallPrimes.Add(u3); + smallPrimes.Add(v1); + smallPrimes.Add(v2); + smallPrimes.Add(v3); + } + public override string Name { get { return "NaccacheStern"; } @@ -91,16 +101,6 @@ namespace Org.BouncyCastle.Crypto.Tests { // Test with given key from NaccacheSternPaper (totally insecure) - // First the Parameters from the NaccacheStern Paper - // (see http://www.gemplus.com/smart/rd/publications/pdf/NS98pkcs.pdf ) - - smallPrimes.Add(u1); - smallPrimes.Add(u2); - smallPrimes.Add(u3); - smallPrimes.Add(v1); - smallPrimes.Add(v2); - smallPrimes.Add(v3); - NaccacheSternKeyParameters pubParameters = new NaccacheSternKeyParameters(false, g, n, sigma.BitLength); NaccacheSternPrivateKeyParameters privParameters = new NaccacheSternPrivateKeyParameters(g, n, sigma -- cgit 1.4.1