private void buttonDecrypte_Click(object sender, EventArgs e) { try { EncryptionRSA rsa = new EncryptionRSA(); TypeConversion tp = new TypeConversion(); richTextBoxDecryption.Text = tp.IntToChar(rsa.Dencryptor(richTextBoxDecryption.Text, textBoxPrivateKey.Text)); } catch (Exception ex) { MessageBox.Show("System Can not Decrypte your Message \n\nExplanation:\nPlease enter Correct Private Key and Correct Encrypted text\n\nException:" + ex.Message + "\n\nPress OK to Proceede"); } }
private void buttonGenratePublicKey_Click(object sender, EventArgs e) { try { EncryptionRSA rsa = new EncryptionRSA(); string CompositeKey = rsa.KeyGenrator(); string[] stArray = CompositeKey.Split('.'); textBoxPublicKey.Text = stArray[0]; textBoxPrivateKeyE.Text = stArray[1]; textBoxPrivateKey.Text = stArray[1]; } catch (Exception ex) { MessageBox.Show("System Can not genrate Public and Private Keys \n\nException:\n" + ex.Message + "\n\nPress OK to Proceede"); } }
private void buttonEncrypte_Click(object sender, EventArgs e) { #region --[this should be replaced after testing all key 1111111 output 1]-- //try //{ // EncryptionRSA rsa = new EncryptionRSA(); // string CompositeKey = rsa.KeyGenrator(); // string[] stArray = CompositeKey.Split('.'); // textBoxPublicKey.Text = stArray[0]; // textBoxPrivateKeyE.Text = stArray[1]; //} //catch //{ // MessageBox.Show("Exeption Occured"); //} #endregion try { EncryptionRSA rsa = new EncryptionRSA(); TypeConversion tp = new TypeConversion(); RSAKeys rks = new RSAKeys(); int keyPropf = rks.ValidatePublicKeys(textBoxPublicKey.Text); if (keyPropf == 0) { int b, a = 1; b = a / keyPropf; } richTextBoxEncrypte.Text = rsa.Encryptor(tp.CharToInt(richTextBoxEncrypte.Text), textBoxPublicKey.Text); buttonEncrypte.Enabled = false; buttonProceedeForCompression.Enabled = true; } catch (Exception ex) { buttonProceedeForCompression.Enabled = false; buttonEncrypte.Enabled = true; MessageBox.Show("System Can Not Encryte Your Message \n\nExplanation:\nPlease there must be text in the main text and\nGenrate/Enter correct Public Key in the respected text box\n\nExeption : " + ex.Message + "\n\nPress OK to proceede"); } #region --[this aslo belong to region 1111 output and work with it]-- //buttonSaveEncryptedCompressedText.Visible = true; //buttonEncrypte.Visible = false; #endregion }