Ejemplo n.º 1
0
        private void btnDekript_Click(object sender, EventArgs e)
        {
            RSAAlgorithm r    = new RSAAlgorithm(UInt32.Parse(txtP.Text), UInt32.Parse(txtQ.Text), UInt32.Parse(txtE.Text));
            int          ulaz = int.Parse(txtUlaz.Text);

            byte[] izlaz = r.Decrypt(BitConverter.GetBytes(ulaz));
            uint   cr    = BitConverter.ToUInt32(izlaz, 0);

            txtKript.Text = cr.ToString();
        }
Ejemplo n.º 2
0
        private void btnDek_Click(object sender, EventArgs e)
        {
            if (fileForCryptPath.Equals(""))
            {
                MessageBox.Show("File isn't selected!", "Missing file!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            byte[] file = null;

            file = File.ReadAllBytes(@".\\Crypted\\" + fileForCryptName + fileExtension);

            byte[] decryptedFile = algorithm.Decrypt(file);
            File.WriteAllBytes(@".\\Decrypted\\" + fileForCryptName + fileExtension, decryptedFile);
        }