private void textBoxP_TextChanged(object sender, EventArgs e) { try { textBoxN.Text = AllFunctions.ComputeN(Convert.ToInt32(textBoxQ.Text), Convert.ToInt32(textBoxP.Text)) .ToString(); textBoxFN.Text = AllFunctions.ComputeFn(Convert.ToInt32(textBoxQ.Text), Convert.ToInt32(textBoxP.Text)) .ToString(); } catch { //ignore } }
private void button5_Click(object sender, EventArgs e) { try { var p = Convert.ToInt32(textBoxP.Text); var q = Convert.ToInt32(textBoxQ.Text); var E = Convert.ToInt32(textBoxE.Text); _rsa.InitKeys(p, q, E); textBoxD.Text = _rsa.PrivateKey.Key.ToString(); textBoxN.Text = AllFunctions.ComputeN(p, q).ToString(); textBoxFN.Text = AllFunctions.ComputeFn(p, q).ToString(); } catch (InvalidCastException) { MessageBox.Show("Cant Parse"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }