GenerateSignature() public method

public GenerateSignature ( byte message ) : Org.BouncyCastle.Math.BigInteger[]
message byte
return Org.BouncyCastle.Math.BigInteger[]
Ejemplo n.º 1
0
			public ITestResult Perform()
			{
				BigInteger r = new BigInteger("860d82c60e9502cd00c0e9e1f6563feafec304801974d745c5e02079946f729e",16);
				BigInteger s = new BigInteger("7ef49264ef022801aaa03033cd97915235fbab4c823ed936b0f360c22114688a",16);
				Gost3410ParametersGenerator pGen = new Gost3410ParametersGenerator();

				pGen.Init(1024, 2, init_random);

				Gost3410Parameters parameters = pGen.GenerateParameters();

				if (!pValue.Equals(parameters.P) || !qValue.Equals(parameters.Q))
				{
					return new SimpleTestResult(false, Name + ": p or q wrong");
				}

				Gost3410KeyPairGenerator Gost3410KeyGen = new Gost3410KeyPairGenerator();
				Gost3410KeyGenerationParameters genParam = new Gost3410KeyGenerationParameters(keyRandom, parameters);

				Gost3410KeyGen.Init(genParam);

				AsymmetricCipherKeyPair pair = Gost3410KeyGen.GenerateKeyPair();

				ParametersWithRandom param = new ParametersWithRandom(pair.Private, random);

				Gost3410Signer Gost3410 = new Gost3410Signer();

				Gost3410.Init(true, param);

				BigInteger[] sig = Gost3410.GenerateSignature(hashmessage);

				if (!r.Equals(sig[0]))
				{
					return new SimpleTestResult(false, Name
						+ ": r component wrong." + SimpleTest.NewLine
						+ " expecting: " + r.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[0].ToString(16));
				}

				if (!s.Equals(sig[1]))
				{
					return new SimpleTestResult(false, Name
						+ ": s component wrong." + SimpleTest.NewLine
						+ " expecting: " + s.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[1].ToString(16));
				}

				Gost3410.Init(false, pair.Public);

				if (Gost3410.VerifySignature(hashmessage, sig[0], sig[1]))
				{
					return new SimpleTestResult(true, Name + ": Okay");
				}
				else
				{
					return new SimpleTestResult(false, Name + ": verification fails");
				}
			}
Ejemplo n.º 2
0
			public ITestResult Perform()
			{
				BigInteger r = new BigInteger("4deb95a0b35e7ed7edebe9bef5a0f93739e16b7ff27fe794d989d0c13159cfbc",16);
				BigInteger s = new BigInteger("e1d0d30345c24cfeb33efde3deee5fbbda78ddc822b719d860cd0ba1fb6bd43b",16);
				Gost3410ParametersGenerator pGen = new Gost3410ParametersGenerator();

				pGen.Init(1024, 2, init_random);

				Gost3410Parameters parameters = pGen.GenerateParameters();

				if (!pValue.Equals(parameters.P) || !qValue.Equals(parameters.Q))
				{
					return new SimpleTestResult(false, Name + ": p or q wrong");
				}

				Gost3410KeyPairGenerator Gost3410KeyGen = new Gost3410KeyPairGenerator();
				Gost3410KeyGenerationParameters genParam = new Gost3410KeyGenerationParameters(keyRandom, parameters);

				Gost3410KeyGen.Init(genParam);

				AsymmetricCipherKeyPair pair = Gost3410KeyGen.GenerateKeyPair();

				ParametersWithRandom param = new ParametersWithRandom(pair.Private, random);

				Gost3410Signer Gost3410 = new Gost3410Signer();

				Gost3410.Init(true, param);

				BigInteger[] sig = Gost3410.GenerateSignature(hashmessage);

				if (!r.Equals(sig[0]))
				{
					return new SimpleTestResult(false, Name
						+ ": r component wrong." + SimpleTest.NewLine
						+ " expecting: " + r.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[0].ToString(16));
				}

				if (!s.Equals(sig[1]))
				{
					return new SimpleTestResult(false, Name
						+ ": s component wrong." + SimpleTest.NewLine
						+ " expecting: " + s.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[1].ToString(16));
				}

				Gost3410.Init(false, pair.Public);

				if (Gost3410.VerifySignature(hashmessage, sig[0], sig[1]))
				{
					return new SimpleTestResult(true, Name + ": Okay");
				}
				else
				{
					return new SimpleTestResult(false, Name + ": verification fails");
				}
			}
Ejemplo n.º 3
0
			public ITestResult Perform()
			{
				BigInteger              r = new BigInteger("81d69a192e9c7ac21fc07da41bd07e230ba6a94eb9f3c1fd104c7bd976733ca5",16);
				BigInteger              s = new BigInteger("315c879c8414f35feb4deb15e7cc0278c48e6ca1596325d6959338d860b0c47a",16);
				Gost3410ParametersGenerator  pGen = new Gost3410ParametersGenerator();

				pGen.Init(1024, 2, init_random);

				Gost3410Parameters           parameters = pGen.GenerateParameters();

				if (!pValue.Equals(parameters.P) || !qValue.Equals(parameters.Q))
				{
					return new SimpleTestResult(false, Name + ": p or q wrong");
				}

				Gost3410KeyPairGenerator         Gost3410KeyGen = new Gost3410KeyPairGenerator();
				Gost3410KeyGenerationParameters  genParam = new Gost3410KeyGenerationParameters(keyRandom, parameters);

				Gost3410KeyGen.Init(genParam);

				AsymmetricCipherKeyPair  pair = Gost3410KeyGen.GenerateKeyPair();

				ParametersWithRandom param = new ParametersWithRandom(pair.Private, random);

				Gost3410Signer Gost3410 = new Gost3410Signer();

				Gost3410.Init(true, param);

				BigInteger[] sig = Gost3410.GenerateSignature(hashmessage);

				if (!r.Equals(sig[0]))
				{
					return new SimpleTestResult(false, Name
						+ ": r component wrong." + SimpleTest.NewLine
						+ " expecting: " + r.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[0].ToString(16));
				}

				if (!s.Equals(sig[1]))
				{
					return new SimpleTestResult(false, Name
						+ ": s component wrong." + SimpleTest.NewLine
						+ " expecting: " + s.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[1].ToString(16));
				}

				Gost3410.Init(false, pair.Public);

				if (Gost3410.VerifySignature(hashmessage, sig[0], sig[1]))
				{
					return new SimpleTestResult(true, Name + ": Okay");
				}
				else
				{
					return new SimpleTestResult(false, Name + ": verification fails");
				}
			}
Ejemplo n.º 4
0
			public ITestResult Perform()
			{
				BigInteger r = new BigInteger("64a8856628e5669d85f62cd763dd4a99bc56d33dc0e1859122855d141e9e4774",16);
				BigInteger s = new BigInteger("319ebac97092b288d469a4b988248794f60c865bc97858d9a3135c6d1a1bf2dd",16);
				Gost3410ParametersGenerator pGen = new Gost3410ParametersGenerator();

				pGen.Init(1024, 2, init_random);

				Gost3410Parameters parameters = pGen.GenerateParameters();

				if (!pValue.Equals(parameters.P) || !qValue.Equals(parameters.Q))
				{
					return new SimpleTestResult(false, Name + ": p or q wrong");
				}

				Gost3410KeyPairGenerator Gost3410KeyGen = new Gost3410KeyPairGenerator();
				Gost3410KeyGenerationParameters genParam = new Gost3410KeyGenerationParameters(keyRandom, parameters);

				Gost3410KeyGen.Init(genParam);

				AsymmetricCipherKeyPair pair = Gost3410KeyGen.GenerateKeyPair();

				ParametersWithRandom param = new ParametersWithRandom(pair.Private, random);

				Gost3410Signer Gost3410 = new Gost3410Signer();

				Gost3410.Init(true, param);

				BigInteger[] sig = Gost3410.GenerateSignature(hashmessage);

				if (!r.Equals(sig[0]))
				{
					return new SimpleTestResult(false, Name
						+ ": r component wrong." + SimpleTest.NewLine
						+ " expecting: " + r.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[0].ToString(16));
				}

				if (!s.Equals(sig[1]))
				{
					return new SimpleTestResult(false, Name
						+ ": s component wrong." + SimpleTest.NewLine
						+ " expecting: " + s.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[1].ToString(16));
				}

				Gost3410.Init(false, pair.Public);

				if (Gost3410.VerifySignature(hashmessage, sig[0], sig[1]))
				{
					return new SimpleTestResult(true, Name + ": Okay");
				}
				else
				{
					return new SimpleTestResult(false, Name + ": verification fails");
				}
			}
Ejemplo n.º 5
0
			public ITestResult Perform()
			{
				BigInteger r = new BigInteger("a8790aabbd5a998ff524bad048ac69cd1faff2dab048265c8d60d1471c44a9ee",16);
				BigInteger s = new BigInteger("30df5ba32ac77170b9632559bef7d37620017756dff3fea1088b4267db0944b8",16);
				Gost3410ParametersGenerator pGen = new Gost3410ParametersGenerator();

				pGen.Init(1024, 1, init_random);

				Gost3410Parameters parameters = pGen.GenerateParameters();

				if (!pValue.Equals(parameters.P) || !qValue.Equals(parameters.Q))
				{
					return new SimpleTestResult(false, Name + ": p or q wrong");
				}

				Gost3410KeyPairGenerator Gost3410KeyGen = new Gost3410KeyPairGenerator();
				Gost3410KeyGenerationParameters genParam = new Gost3410KeyGenerationParameters(keyRandom, parameters);

				Gost3410KeyGen.Init(genParam);

				AsymmetricCipherKeyPair pair = Gost3410KeyGen.GenerateKeyPair();

				ParametersWithRandom param = new ParametersWithRandom(pair.Private, random);

				Gost3410Signer Gost3410 = new Gost3410Signer();

				Gost3410.Init(true, param);

				BigInteger[] sig = Gost3410.GenerateSignature(hashmessage);

				if (!r.Equals(sig[0]))
				{
					return new SimpleTestResult(false, Name
						+ ": r component wrong." + SimpleTest.NewLine
						+ " expecting: " + r.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[0].ToString(16));
				}

				if (!s.Equals(sig[1]))
				{
					return new SimpleTestResult(false, Name
						+ ": s component wrong." + SimpleTest.NewLine
						+ " expecting: " + s.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[1].ToString(16));
				}

				Gost3410.Init(false, pair.Public);

				if (Gost3410.VerifySignature(hashmessage, sig[0], sig[1]))
				{
					return new SimpleTestResult(true, Name + ": Okay");
				}
				else
				{
					return new SimpleTestResult(false, Name + ": verification fails");
				}
			}
Ejemplo n.º 6
0
			public ITestResult Perform()
			{
				BigInteger r = new BigInteger("3e5f895e276d81d2d52c0763270a458157b784c57abdbd807bc44fd43a32ac06",16);
				BigInteger s = new BigInteger("3f0dd5d4400d47c08e4ce505ff7434b6dbf729592e37c74856dab85115a60955",16);
				Gost3410ParametersGenerator pGen = new Gost3410ParametersGenerator();

				pGen.Init(512, 1, init_random);

				Gost3410Parameters parameters = pGen.GenerateParameters();

				if (parameters.ValidationParameters == null)
				{
					return new SimpleTestResult(false, Name + "validation parameters wrong");
				}

				if (parameters.ValidationParameters.C != 29505
					||  parameters.ValidationParameters.X0 != 24265)
				{
					return new SimpleTestResult(false, Name + "validation parameters values wrong");
				}

				if (!init_random.IsExhausted)
				{
					return new SimpleTestResult(false, Name
						+ ": unexpected number of bytes used from 'init_random'.");
				}

				if (!pValue.Equals(parameters.P) || !qValue.Equals(parameters.Q))
				{
					return new SimpleTestResult(false, Name + ": p or q wrong");
				}

				Gost3410KeyPairGenerator         Gost3410KeyGen = new Gost3410KeyPairGenerator();
				Gost3410KeyGenerationParameters  genParam = new Gost3410KeyGenerationParameters(keyRandom, parameters);

				Gost3410KeyGen.Init(genParam);

				AsymmetricCipherKeyPair  pair = Gost3410KeyGen.GenerateKeyPair();

				if (!keyRandom.IsExhausted)
				{
					return new SimpleTestResult(false, Name
						+ ": unexpected number of bytes used from 'keyRandom'.");
				}

				ParametersWithRandom param = new ParametersWithRandom(pair.Private, random);

				Gost3410Signer gost3410 = new Gost3410Signer();

				gost3410.Init(true, param);

				BigInteger[] sig = gost3410.GenerateSignature(hashmessage);

				if (!random.IsExhausted)
				{
					return new SimpleTestResult(false, Name
						+ ": unexpected number of bytes used from 'random'.");
				}

				if (!r.Equals(sig[0]))
				{
					return new SimpleTestResult(false, Name
						+ ": r component wrong." + SimpleTest.NewLine
						+ " expecting: " + r.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[0].ToString(16));
				}

				if (!s.Equals(sig[1]))
				{
					return new SimpleTestResult(false, Name
						+ ": s component wrong." + SimpleTest.NewLine
						+ " expecting: " + s.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[1].ToString(16));
				}

				gost3410.Init(false, pair.Public);

				if (gost3410.VerifySignature(hashmessage, sig[0], sig[1]))
				{
					return new SimpleTestResult(true, Name + ": Okay");
				}
				else
				{
					return new SimpleTestResult(false, Name + ": verification fails");
				}
			}
Ejemplo n.º 7
0
			public ITestResult Perform()
			{
				BigInteger r = new BigInteger("169fdb2dc09f690b71332432bfec806042e258fa9a21dafe73c6abfbc71407d9",16);
				BigInteger s = new BigInteger("9002551808ae40d19f6f31fb67e4563101243cf07cffd5f2f8ff4c537b0c9866",16);
				Gost3410ParametersGenerator pGen = new Gost3410ParametersGenerator();

				pGen.Init(1024, 2, init_random);

				Gost3410Parameters parameters = pGen.GenerateParameters();

				if (!pValue.Equals(parameters.P) || !qValue.Equals(parameters.Q))
				{
					return new SimpleTestResult(false, Name + ": p or q wrong");
				}

				Gost3410KeyPairGenerator Gost3410KeyGen = new Gost3410KeyPairGenerator();
				Gost3410KeyGenerationParameters genParam = new Gost3410KeyGenerationParameters(keyRandom, parameters);

				Gost3410KeyGen.Init(genParam);

				AsymmetricCipherKeyPair pair = Gost3410KeyGen.GenerateKeyPair();

				ParametersWithRandom param = new ParametersWithRandom(pair.Private, random);

				Gost3410Signer Gost3410 = new Gost3410Signer();

				Gost3410.Init(true, param);

				BigInteger[] sig = Gost3410.GenerateSignature(hashmessage);

				if (!r.Equals(sig[0]))
				{
					return new SimpleTestResult(false, Name
						+ ": r component wrong." + SimpleTest.NewLine
						+ " expecting: " + r.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[0].ToString(16));
				}

				if (!s.Equals(sig[1]))
				{
					return new SimpleTestResult(false, Name
						+ ": s component wrong." + SimpleTest.NewLine
						+ " expecting: " + s.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[1].ToString(16));
				}

				Gost3410.Init(false, pair.Public);

				if (Gost3410.VerifySignature(hashmessage, sig[0], sig[1]))
				{
					return new SimpleTestResult(true, Name + ": Okay");
				}
				else
				{
					return new SimpleTestResult(false, Name + ": verification fails");
				}
			}
Ejemplo n.º 8
0
			public ITestResult Perform()
			{
				BigInteger r = new BigInteger("7c07c8cf035c2a1cb2b7fae5807ac7cd623dfca7a1a68f6d858317822f1ea00d",16);
				BigInteger s = new BigInteger("7e9e036a6ff87dbf9b004818252b1f6fc310bdd4d17cb8c37d9c36c7884de60c",16);
				Gost3410ParametersGenerator  pGen = new Gost3410ParametersGenerator();

				pGen.Init(512, 2, init_random);

				Gost3410Parameters parameters = pGen.GenerateParameters();

				if (!init_random.IsExhausted)
				{
					return new SimpleTestResult(false, Name
						+ ": unexpected number of bytes used from 'init_random'.");
				}

				if (parameters.ValidationParameters == null)
				{
					return new SimpleTestResult(false, Name + ": validation parameters wrong");
				}

				if (parameters.ValidationParameters.CL != 13
					||  parameters.ValidationParameters.X0L != 1039943409)
				{
					return new SimpleTestResult(false, Name + ": validation parameters values wrong");
				}

				if (!pValue.Equals(parameters.P) || !qValue.Equals(parameters.Q))
				{
					return new SimpleTestResult(false, Name + ": p or q wrong");
				}

				Gost3410KeyPairGenerator Gost3410KeyGen = new Gost3410KeyPairGenerator();
				Gost3410KeyGenerationParameters genParam = new Gost3410KeyGenerationParameters(keyRandom, parameters);

				Gost3410KeyGen.Init(genParam);

				AsymmetricCipherKeyPair pair = Gost3410KeyGen.GenerateKeyPair();

				if (!keyRandom.IsExhausted)
				{
					return new SimpleTestResult(false, Name
						+ ": unexpected number of bytes used from 'keyRandom'.");
				}

				ParametersWithRandom param = new ParametersWithRandom(pair.Private, random);

				Gost3410Signer Gost3410 = new Gost3410Signer();

				Gost3410.Init(true, param);

				BigInteger[] sig = Gost3410.GenerateSignature(hashmessage);

				if (!random.IsExhausted)
				{
					return new SimpleTestResult(false, Name
						+ ": unexpected number of bytes used from 'random'.");
				}

				if (!r.Equals(sig[0]))
				{
					return new SimpleTestResult(false, Name
						+ ": r component wrong." + SimpleTest.NewLine
						+ " expecting: " + r.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[0].ToString(16));
				}

				if (!s.Equals(sig[1]))
				{
					return new SimpleTestResult(false, Name
						+ ": s component wrong." + SimpleTest.NewLine
						+ " expecting: " + s.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[1].ToString(16));
				}

				Gost3410.Init(false, pair.Public);

				if (!Gost3410.VerifySignature(hashmessage, sig[0], sig[1]))
				{
					return new SimpleTestResult(false, Name + ": verification fails");
				}

				return new SimpleTestResult(true, Name + ": Okay");
			}
Ejemplo n.º 9
0
			public ITestResult Perform()
			{
				BigInteger r = new BigInteger("8f79a582513df84dc247bcb624340cc0e5a34c4324a20ce7fe3ab8ff38a9db71",16);
				BigInteger s = new BigInteger("7508d22fd6cbb45efd438cb875e43f137247088d0f54b29a7c91f68a65b5fa85",16);
				Gost3410ParametersGenerator pGen = new Gost3410ParametersGenerator();

				pGen.Init(1024, 2, init_random);

				Gost3410Parameters parameters = pGen.GenerateParameters();

				if (!pValue.Equals(parameters.P) || !qValue.Equals(parameters.Q))
				{
					return new SimpleTestResult(false, Name + ": p or q wrong");
				}

				Gost3410KeyPairGenerator Gost3410KeyGen = new Gost3410KeyPairGenerator();
				Gost3410KeyGenerationParameters genParam = new Gost3410KeyGenerationParameters(keyRandom, parameters);

				Gost3410KeyGen.Init(genParam);

				AsymmetricCipherKeyPair pair = Gost3410KeyGen.GenerateKeyPair();

				ParametersWithRandom param = new ParametersWithRandom(pair.Private, random);

				Gost3410Signer Gost3410 = new Gost3410Signer();

				Gost3410.Init(true, param);

				BigInteger[] sig = Gost3410.GenerateSignature(hashmessage);

				if (!r.Equals(sig[0]))
				{
					return new SimpleTestResult(false, Name
						+ ": r component wrong." + SimpleTest.NewLine
						+ " expecting: " + r.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[0].ToString(16));
				}

				if (!s.Equals(sig[1]))
				{
					return new SimpleTestResult(false, Name
						+ ": s component wrong." + SimpleTest.NewLine
						+ " expecting: " + s.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[1].ToString(16));
				}

				Gost3410.Init(false, pair.Public);

				if (Gost3410.VerifySignature(hashmessage, sig[0], sig[1]))
				{
					return new SimpleTestResult(true, Name + ": Okay");
				}
				else
				{
					return new SimpleTestResult(false, Name + ": verification fails");
				}
			}
Ejemplo n.º 10
0
			public ITestResult Perform()
			{
				BigInteger r = new BigInteger("90892707282f433398488f19d31ac48523a8e2ded68944e0da91c6895ee7045e",16);
				BigInteger s = new BigInteger("3be4620ee88f1ee8f9dd63c7d145b7e554839feeca125049118262ea4651e9de",16);
				Gost3410ParametersGenerator pGen = new Gost3410ParametersGenerator();

				pGen.Init(1024, 2, init_random);

				Gost3410Parameters parameters = pGen.GenerateParameters();

				if (!pValue.Equals(parameters.P) || !qValue.Equals(parameters.Q))
				{
					return new SimpleTestResult(false, Name + ": p or q wrong");
				}

				Gost3410KeyPairGenerator Gost3410KeyGen = new Gost3410KeyPairGenerator();
				Gost3410KeyGenerationParameters genParam = new Gost3410KeyGenerationParameters(keyRandom, parameters);

				Gost3410KeyGen.Init(genParam);

				AsymmetricCipherKeyPair pair = Gost3410KeyGen.GenerateKeyPair();

				ParametersWithRandom param = new ParametersWithRandom(pair.Private, random);

				Gost3410Signer Gost3410 = new Gost3410Signer();

				Gost3410.Init(true, param);

				BigInteger[] sig = Gost3410.GenerateSignature(hashmessage);

				if (!r.Equals(sig[0]))
				{
					return new SimpleTestResult(false, Name
						+ ": r component wrong." + SimpleTest.NewLine
						+ " expecting: " + r.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[0].ToString(16));
				}

				if (!s.Equals(sig[1]))
				{
					return new SimpleTestResult(false, Name
						+ ": s component wrong." + SimpleTest.NewLine
						+ " expecting: " + s.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[1].ToString(16));
				}

				Gost3410.Init(false, pair.Public);

				if (Gost3410.VerifySignature(hashmessage, sig[0], sig[1]))
				{
					return new SimpleTestResult(true, Name + ": Okay");
				}
				else
				{
					return new SimpleTestResult(false, Name + ": verification fails");
				}
			}
Ejemplo n.º 11
0
			public ITestResult Perform()
			{
				BigInteger              r = new BigInteger("712592d285b792e33b8a9a11e8e6c4f512ddf0042972bbfd1abb0a93e8fc6f54",16);
				BigInteger              s = new BigInteger("2cf26758321258b130d5612111339f09ceb8668241f3482e38baa56529963f07",16);
				Gost3410ParametersGenerator  pGen = new Gost3410ParametersGenerator();

				pGen.Init(1024, 2, init_random);

				Gost3410Parameters parameters = pGen.GenerateParameters();

				if (!pValue.Equals(parameters.P) || !qValue.Equals(parameters.Q))
				{
					return new SimpleTestResult(false, Name + ": p or q wrong");
				}

				Gost3410KeyPairGenerator Gost3410KeyGen = new Gost3410KeyPairGenerator();
				Gost3410KeyGenerationParameters genParam = new Gost3410KeyGenerationParameters(keyRandom, parameters);

				Gost3410KeyGen.Init(genParam);

				AsymmetricCipherKeyPair pair = Gost3410KeyGen.GenerateKeyPair();

				ParametersWithRandom param = new ParametersWithRandom(pair.Private, random);

				Gost3410Signer Gost3410 = new Gost3410Signer();

				Gost3410.Init(true, param);

				BigInteger[] sig = Gost3410.GenerateSignature(hashmessage);

				if (!r.Equals(sig[0]))
				{
					return new SimpleTestResult(false, Name
						+ ": r component wrong." + SimpleTest.NewLine
						+ " expecting: " + r.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[0].ToString(16));
				}

				if (!s.Equals(sig[1]))
				{
					return new SimpleTestResult(false, Name
						+ ": s component wrong." + SimpleTest.NewLine
						+ " expecting: " + s.ToString(16) + SimpleTest.NewLine
						+ " got      : " + sig[1].ToString(16));
				}

				Gost3410.Init(false, pair.Public);

				if (Gost3410.VerifySignature(hashmessage, sig[0], sig[1]))
				{
					return new SimpleTestResult(true, Name + ": Okay");
				}
				else
				{
					return new SimpleTestResult(false, Name + ": verification fails");
				}
			}