Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                using (StreamReader messageFile = new StreamReader(openFileDialog1.FileName))
                {
                    String    message = messageFile.ReadLine();
                    CipherRSA RSA     = new CipherRSA(long.Parse(textBox1.Text), long.Parse(textBox2.Text), message);

                    using (StreamWriter encrMessageFile = new StreamWriter("EncryptedMessage.txt"))
                    {
                        RSA.Encrypt(encrMessageFile);
                    }
                }
            }
        }
Пример #2
0
        private void button2_Click(object sender, EventArgs a)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                using (StreamReader encrMessageFile = new StreamReader(openFileDialog1.FileName))
                {
                    String[] value = new String[4];
                    value = encrMessageFile.ReadLine().Split(',');

                    long n       = long.Parse(value[0]);
                    long e       = long.Parse(value[1]);
                    long message = long.Parse(value[2]);
                    long sign    = long.Parse(value[3]);

                    CipherRSA cipherRSA = new CipherRSA();

                    textBox3.Text = cipherRSA.checkEncryptedMessage(n, e, message, sign).ToString();
                }
            }
        }