private void requestOtherUsersPublicKeyButton_Click(object sender, EventArgs e) { ElGamalPublicKey otherUsersPublicKey = this.ReferenceToOtherAssignment3User.MyPublicKey; if (otherUsersPublicKey == null) { MessageBox.Show("The Other User Hasn't Generated Their Keys Yet", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { this.otherUsersPLabel.Text = otherUsersPublicKey.P.ToString(); this.otherUsersAlphaLabel.Text = otherUsersPublicKey.Alpha.ToString(); this.otherUsersAlphaToALabel.Text = otherUsersPublicKey.AlphaToA.ToString(); this.plainTextTextBox.Enabled = true; } }
private void generateKeysButton_Click(object sender, EventArgs e) { elGamal = new ElGamal(this.PrimalityTestToUse, this.SecurityToken); elGamal.KeyGeneration(KeySize); ElGamalPublicKey publicKey = elGamal.PublicKey; this.pLabel.Text = publicKey.P.ToString(); this.alphaLabel.Text = publicKey.Alpha.ToString(); this.alphaToALabel.Text = publicKey.AlphaToA.ToString(); ElGamalPrivateKey privateKey = elGamal.PrivateKey; this.aLabel.Text = privateKey.A.ToString(); this.MyPublicKey = publicKey; this.MyPrivateKey = privateKey; }
public ElGamalPublicKey RequestElGamalPublicKey() { elGamal = new ElGamal(this.PrimalityTestToUse, this.SecurityToken); elGamal.KeyGeneration(KeySize); ElGamalPublicKey publicKey = elGamal.PublicKey; this.p2Label.Text = publicKey.P.ToString(); this.alphaLabel.Text = publicKey.Alpha.ToString(); this.alphaToALabel.Text = publicKey.AlphaToA.ToString(); ElGamalPrivateKey privateKey = elGamal.PrivateKey; this.aLabel.Text = privateKey.A.ToString(); //this.qLabel.Text = privateKey.Q.ToString(); //this.dLabel.Text = privateKey.D.ToString(); //this.phiLabel.Text = privateKey.Phi.ToString(); return(publicKey); }