private void DiffieHellmanGetPartnerPrivateKeyButton_Click(object sender, EventArgs e) { if (this.DiffieHellmanPartnerKeyUpDown.Value > 0 && this.DiffieHellmanOwnKeyResultLabel.Text != String.Empty) { string[] result = this.DiffieHellmanResultLabel.Text.Split(','); var prime = BigInteger.Parse(result[0]); var gen = BigInteger.Parse(this.DiffieHellmanOwnKeyResultLabel.Text); var key = Convert.ToInt16(this.DiffieHellmanPartnerKeyUpDown.Value); this.DiffieHellmanGetPartnerPrivateKeyLabel.Text = CiphersDeciphers.DiffieHellmanCalcKey(key, gen, prime).ToString(); } }
private void DiffieHellmanCalcPartnerKeyButton_Click(object sender, EventArgs e) { if (this.DiffieHellmanResultLabel.Text.Length > 0) { string[] result = this.DiffieHellmanResultLabel.Text.Split(','); var prime = BigInteger.Parse(result[0]); var gen = BigInteger.Parse(result[1]); var key = Convert.ToInt16(this.DiffieHellmanPartnerKeyUpDown.Value); System.Console.WriteLine($"{gen}, {prime}, {key}"); this.DiffieHellmanPartnerKeyResultUpDown.Value = Convert.ToDecimal(CiphersDeciphers.DiffieHellmanCalcKey(key, gen, prime).ToString()); } }
private void DiffieHellmanCalcOwnKeyButton_Click(object sender, EventArgs e) { if (this.DiffieHellmanResultLabel.Text.Length > 0) { string[] result = this.DiffieHellmanResultLabel.Text.Split(','); int prime = Convert.ToInt32(result[0]); int gen = Convert.ToInt32(result[1]); var key = Convert.ToInt16(this.DiffieHellmanOwnKeyUpDown.Value); System.Console.WriteLine($"{gen}, {prime}, {key}"); this.DiffieHellmanOwnKeyResultLabel.Text = CiphersDeciphers.DiffieHellmanCalcKey(key, gen, prime).ToString(); } }