Exemple #1
0
        private void extractButton_Click(object sender, EventArgs e)
        {
            b = (Bitmap)imagePictureBox.Image;

            string messageExt = SteganographyHelper.msgRetrieve(b);

            if (encryptCheckBox.Checked)
            {
                try
                {
                    messageExt = Crypto.AES_Dec(messageExt, passwordTextBox.Text);
                }
                catch
                {
                    MessageBox.Show("Wrong password", "Error");

                    return;
                }
            }

            dataTextBox.Text = messageExt;
        }
        private void extractButton_Click(object sender, EventArgs e)
        {
            b = (Bitmap)imagePictureBox.Image;

            string messageExt = SteganographyHelper.msgRetrieve(b);

            if (encryptCheckBox.Checked)
            {
                if (encrypTypeDES.Checked)
                {
                    try
                    {
                        byte[] bytes = ASCIIEncoding.ASCII.GetBytes(passwordTextBox.Text);
                        messageExt = DES.Decrypt(messageExt, bytes);
                    }
                    catch
                    {
                        MetroMessageBox.Show(this, "Wrong password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                        return;
                    }
                }
                else if (encrypTypeAES.Checked)
                {
                    try
                    {
                        messageExt = Crypto.AES_Dec(messageExt, passwordTextBox.Text);
                    }
                    catch
                    {
                        MetroMessageBox.Show(this, "Wrong password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
            }

            dataTextBox.Text = messageExt;
        }