private void GenerateAll() { _rsa = new Encrypt.Rsa(); try { _rsa.GenerateAll(); } catch (Exception e) { MessageBox.Show(e.Message); Reset(); return; } pLabel.Text = "p=" + _rsa.P; qLabel.Text = "q=" + _rsa.Q; fnLabel.Text = "Ф(n)=" + _rsa.Fn; eLabel.Text = "e=" + _rsa.E; kLabel.Text = "k=" + _rsa.K; // Secret key nLabel.Text = "n=" + _rsa.N; dLabel.Text = "d=" + _rsa.D; // Open key nTextBox.Text = _rsa.N.ToString(); eTextBox.Text = _rsa.E.ToString(); nTextBox2.Text = _rsa.N.ToString(); eTextBox2.Text = _rsa.E.ToString(); }
private void EncryptButton_Click(object sender, EventArgs e) { Encrypt.Rsa rsa = new Encrypt.Rsa(); rsa.N = Convert.ToInt32(nTextBox.Text); rsa.E = Convert.ToInt32(eTextBox.Text); string message = sourceRichTextBox1.Text; string encrytedMessage = rsa.Encrypt(message); encryptedRichTextBox.Text = encrytedMessage; encryptedRichTextBox2.Text = encrytedMessage; }