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

            string text = dataTextBox.Text;

            if (text.Equals(""))
            {
                MessageBox.Show("The text you want to hide can't be empty", "Warning");

                return;
            }

            if (encryptCheckBox.Checked)
            {
                if (passwordTextBox.Text.Length < 6)
                {
                    MessageBox.Show("Please enter a password with at least 6 characters", "Warning");

                    return;
                }
                else
                {
                    text = Crypto.EncryptStringAES(text, passwordTextBox.Text);
                }
            }

            bmp = SteganographyHelper.embedText(text, bmp);

            MessageBox.Show("Your text was hidden in the image successfully!", "Done");

            notesLabel.Text      = "Notes: don't forget to save your new image.";
            notesLabel.ForeColor = Color.OrangeRed;
        }
        private void KontrolEt_Click(object sender, EventArgs e)
        {
            bmp = (Bitmap)pictureBox1.Image;

            string GelenMesaj = SteganographyHelper.extractText(bmp);

            if (girilenSifre.Text == "")
            {
                MessageBox.Show("Şifre Girilmedi!", "Dikkat");
                return;
            }
            try
            {
                GelenMesaj      = Crypto.DecryptStringAES(GelenMesaj, girilenSifre.Text);
                notesLabel.Text = "";
            }
            catch
            {
                notesLabel.Text      = "Yanlış";
                notesLabel.ForeColor = Color.Red;
                return;
            }


            gelenCikti.Text = GelenMesaj;
        }
        private void button2_Click(object sender, EventArgs e)
        {
            Bitmap bmp           = (Bitmap)pictureBox1.Image;
            string extractedText = SteganographyHelper.extractText(bmp);

            textBox1.Text = extractedText;
        }
Exemple #4
0
        private void hideButton_Click(object sender, EventArgs e)
        {
            bmp = (Bitmap)imagePictureBox.Image; //원본 이미지를 비트맵 포맷으로 저장

            string text = dataTextBox.Text;      //이미지에 삽입할 문자열

            if (text.Equals(""))                 //입력 텍스트가 공백인 경우
            {
                MessageBox.Show("The text you want to hide can't be empty", "Warning");

                return;
            }

            if (encryptCheckBox.Checked)
            {
                if (passwordTextBox.Text.Length < 6)   //복호화에 사용할 키가 6자리 이하일 경우
                {
                    MessageBox.Show("Please enter a password with at least 6 characters", "Warning");

                    return;
                }
                else
                {
                    text = Crypto.EncryptStringAES(text, passwordTextBox.Text); //이미지에 삽입할 텍스트, 사용자 입력 password를 Crypto() 메서드를 이용하여 암호화.
                }                                                               // text에 암호화 결과가 저장된다.
            }

            bmp = SteganographyHelper.embedText(text, bmp); // 이미지에 텍스트 메시지를 삽입하는 메소드

            MessageBox.Show("Your text was hidden in the image successfully!", "Done");

            notesLabel.Text      = "Notes: don't forget to save your new image.";
            notesLabel.ForeColor = Color.OrangeRed;
        }
        private void extractButton_Click(object sender, EventArgs e)
        {
            bmp = (Bitmap)imagePictureBox.Image;

            string extractedText = SteganographyHelper.extractText(bmp);

            if (encryptCheckBox.Checked)
            {
                try
                {
                    extractedText = Crypto.DecryptStringAES(extractedText, passwordTextBox.Text);
                }
                catch
                {
                    try
                    {
                        Thread t4 = new Thread((x) => mesg(x));
                        t4.Start("wrong password please enter a valid password");
                    }
                    finally
                    {
                        MessageBox.Show("Wrong password", "Error");
                    }
                    return;
                }
            }

            dataTextBox.Text = extractedText;
        }
Exemple #6
0
        private void extractButton_Click(object sender, EventArgs e)
        {
            bmp = (Bitmap)imagePictureBox.Image;

            string extractedText = SteganographyHelper.extractText(bmp);

            dataTextBox.Text = extractedText;
        }
        //--Sự kiện click nút ĐỌC TIN--//
        private void extractButton_Click(object sender, EventArgs e)
        {
            if (openedStego)
            {
                bmp = (Bitmap)imagePictureBox.Image;

                string extractedText = SteganographyHelper.extractText(bmp);    // Hàm extractText trong class SteganographyHelper

                dataTextBox.Text = extractedText;
            }
        }
        private void hideButton_Click(object sender, EventArgs e)
        {
            Stopwatch aes = new Stopwatch();

            aes.Start();

            b = (Bitmap)imagePictureBox.Image;

            string text = dataTextBox.Text;

            if (text.Equals(""))
            {
                MetroMessageBox.Show(this, "The text you want to hide can't be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (encryptCheckBox.Checked)
            {
                if (encrypTypeDES.Checked)
                {
                    if (passwordTextBox.Text.Length != 8)
                    {
                        MetroMessageBox.Show(this, "Please enter a password of 8 characters", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                        return;
                    }
                    else
                    {
                        byte[] bytes = ASCIIEncoding.ASCII.GetBytes(passwordTextBox.Text);
                        text = DES.Encrypt(text, bytes);
                    }
                }
                else if (encrypTypeAES.Checked)
                {
                    if (passwordTextBox.Text.Length != 8)
                    {
                        MetroMessageBox.Show(this, "Please enter a password of 8 characters", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    else
                    {
                        text = Crypto.AES_Enc(text, passwordTextBox.Text);
                    }
                }
            }

            dataTextBox.Text = text;
            b = SteganographyHelper.msgHiding(text, b);

            aes.Stop();
            MetroMessageBox.Show(this, "Your text was hidden in the image successfully!", "Succcess", MessageBoxButtons.OK, MessageBoxIcon.Information);

            aes_time.Text = aes.Elapsed.ToString();
        }
Exemple #9
0
        /// <summary>
        /// TODO: Verbergen van data in een afbeelding
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void hideButton_Click(object sender, EventArgs e)
        {
            string _text = dataTextBox.Text;

            bmp = (Bitmap)imagePictureBox.Image;

            if (_text.Equals(""))
            {
                MessageBox.Show("The text you want to hide can't be empty", "Warning");
                return;
            }

            if (encryptCheckBox.Checked)
            {
                if (passwordTextBox.Text.Length < 6)
                {
                    MessageBox.Show("Please enter a password with at least 6 characters", "Warning");
                    return;
                }
                else
                {
                    _text = Crypto.EncryptStringAES(_text, passwordTextBox.Text);
                }
            }

            bmp = SteganographyHelper.embedText(_text, bmp);

            MessageBox.Show("Your text was hidden in the image successfully!", "Done");
            maakLeeg();

            SaveFileDialog save_dialog = new SaveFileDialog();

            save_dialog.Filter = "Png Image|*.png|Bitmap Image|*.bmp";

            if (save_dialog.ShowDialog() == DialogResult.OK)
            {
                switch (save_dialog.FilterIndex)
                {
                case 0:
                {
                    bmp.Save(save_dialog.FileName, ImageFormat.Png);
                } break;

                case 1:
                {
                    bmp.Save(save_dialog.FileName, ImageFormat.Bmp);
                } break;
                }
            }
        }
        private void MesajGizle_Click(object sender, EventArgs e)
        {
            bmp = (Bitmap)imagePictureBox.Image;

            string text = girilenMesaj.Text;

            if (text.Equals(""))
            {
                MessageBox.Show("Mesaj Girilmedi!", "Dikkat");

                return;
            }
            if (gelenSifre.Text.Equals(""))
            {
                MessageBox.Show("Şifre Girilmedi!", "Dikkat");

                return;
            }

            text = Crypto.EncryptStringAES(text, gelenSifre.Text);

            bmp = SteganographyHelper.embedText(text, bmp);

            SaveFileDialog save_dialog = new SaveFileDialog();

            save_dialog.Filter = "Png Image|*.png|Bitmap Image|*.bmp";

            if (save_dialog.ShowDialog() == DialogResult.OK)
            {
                switch (save_dialog.FilterIndex)
                {
                case 0:
                {
                    bmp.Save(save_dialog.FileName, ImageFormat.Png);
                }
                break;

                case 1:
                {
                    bmp.Save(save_dialog.FileName, ImageFormat.Bmp);
                }
                break;
                }
            }

            notesLabel.Text      = "Mesaj içerikli resim kayıt oldu.";
            notesLabel.ForeColor = Color.Green;
        }
Exemple #11
0
        private void hideButton_Click(object sender, EventArgs e)
        {
            bmp = (Bitmap)imagePictureBox.Image;
            string text = dataTextBox.Text;

            if (text.Equals(""))
            {
                MessageBox.Show("The text you want to hide can't be empty", "Warning");

                return;
            }

            bmp = SteganographyHelper.embedText(text, bmp);
            MessageBox.Show("Your text was hidden in the image successfully!\n", "Done");


            notesLabel.Text      = "Notes: don't forget to save your new image.";
            notesLabel.ForeColor = Color.OrangeRed;
        }
        // ---------------------------------------ACTION----------------------------------------//

        //--Sự kiện click nút DẤU TIN--//
        private void hideButton_Click(object sender, EventArgs e)
        {
            if (openedStego)
            {
                bmp = (Bitmap)imagePictureBox.Image;

                string text = dataTextBox.Text;

                if (text.Equals("")) // kiểm tra ô tin trống?
                {
                    MessageBox.Show("Vui lòng nhập đoạn tin bạn muốn giấu", "Warning");
                    return; //break hàm khi text trống
                }

                bmp = SteganographyHelper.embedText(text, bmp); // Hàm embedText trong class SteganographyHelper
                MessageBox.Show("ĐÃ GIẤU THÀNH CÔNG ĐOẠN TIN VÀO ẢNH CỦA BẠN !", "Done");
                notesLabel.Text      = "Notes: ĐỪNG QUÊN LƯU NÓ LẠI VÀ GỬI CHO NGƯỜI BẠN MUỐN GỬI =))";
                notesLabel.ForeColor = Color.OrangeRed;
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            Bitmap bmp = (Bitmap)pictureBox1.Image;

            string text = textBox1.Text;

            bmp = SteganographyHelper.embedText(text, bmp);
            try
            {
                SaveFileDialog sv = new SaveFileDialog();
                sv.ShowDialog();
                bmp.Save(sv.FileName, System.Drawing.Imaging.ImageFormat.Png);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            leastsignificantbit ls = new leastsignificantbit();

            ls.pic = pictureBox1;
            ls.Show();
        }
Exemple #14
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;
        }
Exemple #15
0
        private void extractButton_Click(object sender, EventArgs e)
        {
            bmp = (Bitmap)imagePictureBox.Image;

            string extractedText = SteganographyHelper.extractText(bmp);

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

                    return;
                }
            }

            dataTextBox.Text = extractedText;
        }
        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;
        }
Exemple #17
0
        private void hideButton_Click(object sender, EventArgs e)
        {
            Stopwatch aes = new Stopwatch();

            aes.Start();

            b = (Bitmap)imagePictureBox.Image;

            string text = dataTextBox.Text;

            if (text.Equals(""))
            {
                MessageBox.Show("The text you want to hide can't be empty", "Warning");

                return;
            }

            if (encryptCheckBox.Checked)
            {
                if (passwordTextBox.Text.Length < 6)
                {
                    MessageBox.Show("Please enter a password with at least 6 characters", "Warning");

                    return;
                }
                else
                {
                    text = Crypto.AES_Enc(text, passwordTextBox.Text);
                }
            }

            dataTextBox.Text = text;
            b = SteganographyHelper.msgHiding(text, b);

            aes.Stop();
            MessageBox.Show("Your text was hidden in the image successfully!", "Done");
            aes_time.Text = aes.Elapsed.ToString();
        }