private void VerifyButton_Click(object sender, EventArgs e) { BigInteger p = new BigInteger("6277101735386680763835789423207666416083908700390324961279", 10); BigInteger a = new BigInteger("-3", 10); BigInteger b = new BigInteger("64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 16); byte[] xG = FromHexStringToByte("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012"); BigInteger n = new BigInteger("ffffffffffffffffffffffff99def836146bc9b1b4d22831", 16); DigitalSign DS = new DigitalSign(p, a, b, n, xG); HashFuncStrebog hash = new HashFuncStrebog(256); long start = DateTime.Now.Second * 1000 + DateTime.Now.Millisecond; byte[] H = hash.GetHash(Encoding.Default.GetBytes(textBox1.Text)); bool result = DS.SingVer(H, textBox2.Text, Q); long finish = DateTime.Now.Second * 1000 + DateTime.Now.Millisecond; long time = finish - start; if (result) { label4.ForeColor = Color.Green; label4.Text = "Correct"; } else { label4.ForeColor = Color.Red; label4.Text = "Wrong"; } }
private void SignButton_Click(object sender, EventArgs e) { // Генерация ключей d = DS.GenereatePrivateKey(192); Q = DS.GeneratePublicKey(d); // Шаг 1: вычисление хэш-суммы Msg HashFuncStrebog hash = new HashFuncStrebog(256); byte[] H = hash.GetHash(Encoding.Default.GetBytes(textBox1.Text)); // подпись Msg string sign = DS.SingMsg(H, d); textBox2.Text = sign; bool result = DS.SingVer(H, sign, Q); }