Exemplo n.º 1
0
        private void btnDecrypt_Click(object sender, EventArgs e)
        {
            string tbValue = tbDecryptKey.Text;

            tbValue = tbValue.Replace("[", "");
            tbValue = tbValue.Replace("]", "");
            string[] values = tbValue.Split(',');
            int      first  = Convert.ToInt32(values[0]);
            int      second = Convert.ToInt32(values[1]);
            string   result = RSAEncrypterDecrypter.Decrypt(new KeyValuePair <int, int>(first, second), tbToDecryptText.Text);

            tbDecryptedOutput.Text = result;
        }
Exemplo n.º 2
0
 private void btnEncrypt_Click(object sender, EventArgs e)
 {
     if (!IsTbEmpty(tbToEncryptText, tbEncryptKey))
     {
         string tbValue = tbEncryptKey.Text;
         tbValue = tbValue.Replace("[", "");
         tbValue = tbValue.Replace("]", "");
         string[]   values = tbValue.Split(',');
         int        first  = Convert.ToInt32(values[0]);
         int        second = Convert.ToInt32(values[1]);
         List <int> result = RSAEncrypterDecrypter.Encrypt(new KeyValuePair <int, int>(first, second), tbToEncryptText.Text);
         tbEncryptedOutput.Text = ListToString(result);
     }
 }