Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (verify_pictureBox(pictureBox1))
            {
                String message, message1, message2, message3;
                Bitmap bmp = (Bitmap)pictureBox1.Image;
                Bitmap bmp_res;
                _SteganographyHelper steg = new _SteganographyHelper();

                int    selector;
                string sym_alg_sel;
                string key_hex;
                string IV_hex;
                string chipertxt;

                int    size;
                string xml;
                string ciphertxt_rsa;

                selector = Convert.ToInt32(steg.extractText(bmp, 0, 0)); //0 for symmetric algorithm 1 for rsa algorithm

                if (selector == 0)
                {
                    sym_alg_sel = steg.extractText(bmp, steg.dec_w_stop, steg.dec_h_stop); // type of sym algorithm (DES,3DES,Rijndael)
                    key_hex     = steg.extractText(bmp, steg.dec_w_stop, steg.dec_h_stop); // Key of the alg
                    IV_hex      = steg.extractText(bmp, steg.dec_w_stop, steg.dec_h_stop); //IV of the alg
                    chipertxt   = steg.extractText(bmp, steg.dec_w_stop, steg.dec_h_stop); //CipherText

                    //MessageBox.Show(chipertxt);
                    //MessageBox.Show(key_hex);
                    //MessageBox.Show(IV_hex);
                    //MessageBox.Show(sym_alg_sel);
                    sym_algorithm_dec(sym_alg_sel, key_hex, IV_hex, chipertxt);
                }
                else
                {
                    bmp_res = (Bitmap)pictureBox1.Image;
                }

                if (selector == 1)
                {
                    size          = Convert.ToInt32(steg.extractText(bmp, steg.dec_w_stop, steg.dec_h_stop));
                    xml           = steg.extractText(bmp, steg.dec_w_stop, steg.dec_h_stop);
                    ciphertxt_rsa = steg.extractText(bmp, steg.w_stop, steg.dec_h_stop);
                }
            }
        }
Example #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (verify_pictureBox(pictureBox1))
            {
                Bitmap bmp = (Bitmap)pictureBox1.Image;
                Bitmap bmp_res;
                _SteganographyHelper steg = new _SteganographyHelper();

                if (Algorithm.selector == 0)
                {
                    bmp_res = steg.embedText(Algorithm.selector.ToString(), bmp, 0, 0);                  //0 for symmetric algorithm 1 for rsa algorithm
                    bmp_res = steg.embedText(Algorithm.sym_alg_selector, bmp, steg.w_stop, steg.h_stop); // type of sym algorithm (DES,3DES,Rijndael)
                    bmp_res = steg.embedText(Algorithm.KeyHex, bmp, steg.w_stop, steg.h_stop);           // Key of the alg
                    bmp_res = steg.embedText(Algorithm.IVHex, bmp, steg.w_stop, steg.h_stop);            //IV of the alg
                    bmp_res = steg.embedText(Algorithm.sym_ciphertext, bmp, steg.w_stop, steg.h_stop);   //CipherText

                    //MessageBox.Show(Algorithm.selector.ToString());
                    //MessageBox.Show(Algorithm.sym_ciphertext);
                }
                else
                {
                    bmp_res = (Bitmap)pictureBox1.Image;
                }

                if (Algorithm.selector == 1)
                {
                    bmp_res = steg.embedText(Algorithm.selector.ToString(), bmp, 0, 0);                 //0 for symmetric algorithm 1 for rsa algorithm
                    bmp_res = steg.embedText(Algorithm.size.ToString(), bmp, steg.w_stop, steg.h_stop); //size of bits
                    bmp_res = steg.embedText(Algorithm.rsa_xml, bmp, steg.w_stop, steg.h_stop);         //rsa xml export
                    bmp_res = steg.embedText(Algorithm.rsa_ciphertext, bmp, steg.w_stop, steg.h_stop);
                }

                //

                pictureBox2.Image = bmp_res;

                button2.Enabled = true;
            }
        }