Beispiel #1
0
        public void MovTestLsb()
        {
            AesAlgo aesAlgo = new AesAlgo();

            using (AesManaged aes = new AesManaged())
            {
                aes.KeySize = 128;
                aes.Padding = PaddingMode.PKCS7;

                var path = @"C:/Users/mamis/Desktop/sample.mov";

                FileStream file      = File.OpenRead(path);
                byte[]     byteVideo = File.ReadAllBytes(path);

                string message = "Im the GOATTTT!!";

                byte[] encryptedData = aesAlgo.EncryptStringToBytes_Aes(message, aes.Key, aes.IV).Concat(aes.Key).Concat(aes.IV).ToArray();

                var binMessage = _decoder.EncryptedByteArrayToBinary(encryptedData);

                _lsbVideo.HideMov(byteVideo, binMessage);

                byte[] cypherData = _lsbVideo.SeekMov(byteVideo);
                byte[] key        = _lsbVideo.ExtractKeyMov(byteVideo);
                byte[] iv         = _lsbVideo.ExtractIvMov(byteVideo);

                var decryptedMessage = aesAlgo.DecryptStringFromBytes_Aes(cypherData, key, iv);

                Console.WriteLine("Secret Massage Is: \n" + decryptedMessage);
                File.WriteAllBytes("C:/Users/mamis/Desktop/outputTest.mov", byteVideo);
            }
        }
Beispiel #2
0
        public void PETestLsb()
        {
            AesAlgo aesAlgo = new AesAlgo();

            using (AesManaged aes = new AesManaged())
            {
                aes.KeySize = 128;
                aes.Padding = PaddingMode.PKCS7;
                var path = @"C:\testfolder\exetest.exe";
                //FileStream file = File.OpenRead(path);
                byte[] byteAudio        = File.ReadAllBytes(path);
                string message          = "TEST lsb aes";
                byte[] encryptedMessage = aesAlgo.EncryptStringToBytes_Aes(message, aes.Key, aes.IV).Concat(aes.Key)
                                          .Concat(aes.IV).ToArray();
                var binMessage = _decoder.EncryptedByteArrayToBinary(encryptedMessage);


                _lsbPe.HidePE(byteAudio, binMessage);

                byte[] cypherData = _lsbPe.SeekPE(byteAudio);
                byte[] key        = _lsbPe.ExtractKeyPE(byteAudio);
                byte[] iv         = _lsbPe.ExtractIvPE(byteAudio);

                var decryptedMessage = aesAlgo.DecryptStringFromBytes_Aes(cypherData, key, iv);

                Console.WriteLine("Secret Massage Is: \n" + decryptedMessage);
                File.WriteAllBytes("C:/Users/Mike/Desktop/pruducta/file_example_WAV_1MG - Copy.wav", byteAudio);
            }
        }
Beispiel #3
0
        public void Mp3TestLsb()
        {
            AesAlgo aesAlgo = new AesAlgo();

            using (AesManaged aes = new AesManaged())
            {
                aes.KeySize = 128;
                aes.Padding = PaddingMode.PKCS7;
                var    path             = @"C:/Users/Mike/Desktop/pruducta/file_example_MP3_2MG - Copy.mp3";
                byte[] byteAudio        = File.ReadAllBytes(path);
                string message          = "tmkescht";
                byte[] encryptedMessage = aesAlgo.EncryptStringToBytes_Aes(message, aes.Key, aes.IV).Concat(aes.Key)
                                          .Concat(aes.IV).ToArray();
                //var binMessage = _decoder.EncryptedByteArrayToBinary(encryptedMessage);
                //byteAudio = _metaDataAudio.GenerateJunk(byteAudio);
                byteAudio = _metaDataAudio.GenerateFramesMp3(byteAudio);
                _metaDataAudio.HideMp3(byteAudio, encryptedMessage);
                byte[] cypherData = _metaDataAudio.SeekMp3(byteAudio);
                byte[] key        = _metaDataAudio.ExtractKeyMp3(byteAudio);
                byte[] iv         = _metaDataAudio.ExtractIvMp3(byteAudio);
                // byteAudio = _lsbAudio.GenerateFrames(byteAudio);
                // _lsbAudio.HideMp3(byteAudio, binMessage);
                //
                // byte[] cypherData = _lsbAudio.SeekMp3(byteAudio);
                // byte[] key = _lsbAudio.ExtractKeyMp3(byteAudio);
                // byte[] iv = _lsbAudio.ExtractIvMp3(byteAudio);

                var decryptedMessage = aesAlgo.DecryptStringFromBytes_Aes(cypherData, key, iv);

                Console.WriteLine("Secret Massage Is: \n" + decryptedMessage);
                File.WriteAllBytes("C:/Users/Mike/Desktop/pruducta/TEST.mp3", byteAudio);
            }
        }
Beispiel #4
0
        public void bmpHide()
        {
            AesAlgo aesAlgo = new AesAlgo();

            using (AesManaged aes = new AesManaged())
            {
                aes.KeySize = 128;
                aes.Padding = PaddingMode.PKCS7;

                var path = @"C:/Users/mamis/Desktop/pic.png";

                var bmp = (Bitmap)Image.FromFile(path);

                string message = "Lebron is the Goat  Lebron is the Goat  ";

                byte[] encryptedData = aesAlgo.EncryptStringToBytes_Aes(message, aes.Key, aes.IV).Concat(aes.Key).Concat(aes.IV).ToArray();

                var binMessage = _decoder.EncryptedByteArrayToBinary(encryptedData);

                _lsbPicture.HideBitmap(bmp, binMessage);

                byte[] cypherData = _lsbPicture.SeekBitmap(bmp);
                byte[] key        = _lsbPicture.ExtractKeyBitmap(bmp);
                byte[] iv         = _lsbPicture.ExtractIvBitmap(bmp);

                var decryptedMessage = aesAlgo.DecryptStringFromBytes_Aes(cypherData, key, iv);

                Console.WriteLine("Secret Massage Is: \n" + decryptedMessage);
                bmp.Save("C:/Users/mamis/Desktop/pica1.jpg", ImageFormat.Tiff);
            }
        }
Beispiel #5
0
        public void bmpSeek()
        {
            AesAlgo aesAlgo = new AesAlgo();
            var     path1   = "C:/Users/mamis/Desktop/pica1.jpg";
            var     bmp     = (Bitmap)Image.FromFile(path1);

            byte[] cypherData = _lsbPicture.SeekBitmap(bmp);
            byte[] key        = _lsbPicture.ExtractKeyBitmap(bmp);
            byte[] iv         = _lsbPicture.ExtractIvBitmap(bmp);

            var decryptedMessage = aesAlgo.DecryptStringFromBytes_Aes(cypherData, key, iv);

            Console.WriteLine("Secret Massage Is: \n" + decryptedMessage);
        }
Beispiel #6
0
        public void JpegHide()
        {
            AesAlgo aesAlgo = new AesAlgo();

            using (AesManaged aes = new AesManaged())
            {
                aes.KeySize = 128;
                aes.Padding = PaddingMode.PKCS7;

                var path  = @"C:/Users/mamis/Desktop/tif.tiff";
                var path2 = @"C:/Users/mamis/Desktop/picOutput.tiff";
                var jpeg  = File.ReadAllBytes(path);

                string message = "Lebron james is the greatest player of all times" +
                                 "Lebron james is the greatest player of all times" +
                                 "Lebron james is the greatest player of all times" +
                                 "Lebron james is the greatest player of all times" +
                                 "Lebron james is the greatest player of all times" +
                                 "Lebron james is the greatest player of all times ";



                byte[] encryptedData = aesAlgo.EncryptStringToBytes_Aes(message, aes.Key, aes.IV);
                encryptedData = encryptedData
                                .Concat(aes.Key)
                                .Concat(aes.IV).ToArray();

                jpeg = _metaDataPicture.HideJpeg(jpeg, encryptedData);
                byte[] cypherData = _metaDataPicture.SeekJpeg(jpeg);
                byte[] key        = _metaDataPicture.ExtractKeyJpeg(jpeg);
                byte[] iv         = _metaDataPicture.ExtractIvJpeg(jpeg);

                var decryptedMessage = aesAlgo.DecryptStringFromBytes_Aes(cypherData, key, iv);

                Console.WriteLine("Secret Massage Is: \n" + decryptedMessage);
                File.WriteAllBytes(path2, jpeg);
            }
        }
Beispiel #7
0
        public void AviTestMetaData()
        {
            AesAlgo aesAlgo = new AesAlgo();

            using (AesManaged aes = new AesManaged())
            {
                aes.KeySize = 128;
                aes.Padding = PaddingMode.PKCS7;

                var path = @"C:/Users/mamis/Desktop/sample.avi";

                FileStream file      = File.OpenRead(path);
                byte[]     byteVideo = File.ReadAllBytes(path);
                string     message   = "  the seven sees?? Lebron is the goat, It is well known all the seven sees." +
                                       "the seven sees?? Lebron is the goat, It is well known all the seven sees" +
                                       "the seven sees?? Lebron is the goat, It is well known all the seven sees" +
                                       "the seven sees?? Lebron is the goat, It is well known all the seven sees" +
                                       "the seven sees?? Lebron is the goat, It is well known all the seven sees??";

                byte[] encryptedData = aesAlgo.EncryptStringToBytes_Aes(message, aes.Key, aes.IV).Concat(aes.Key).Concat(aes.IV)
                                       .ToArray();
                //byte[] b = encryptedData.Concat(aes.Key).ToArray();
                _metaDataVideo.hideAvi(byteVideo, encryptedData);



                byte[] cypherData = _metaDataVideo.SeekAvi(byteVideo);
                byte[] key        = _metaDataVideo.ExtractKeyAvi(byteVideo);
                byte[] iv         = _metaDataVideo.ExtractIvAvi(byteVideo);

                var decryptedMessage = aesAlgo.DecryptStringFromBytes_Aes(cypherData, aes.Key, aes.IV);

                Console.WriteLine("Secret Massage Is: \n" + decryptedMessage);
                File.WriteAllBytes("C:/Users/mamis/Desktop/vidOutput.avi", byteVideo);
            }
        }
Beispiel #8
0
        public string Decrypt_Aes(byte [] cypherData, byte[] key, byte[] iv)
        {
            AesAlgo aesAlgo = new AesAlgo();

            return(aesAlgo.DecryptStringFromBytes_Aes(cypherData, key, iv));
        }