Nghiên cứu phối hợp các phương pháp nén thông tin, mã hóa thông tin, giấu thông tin để đảm bảo an toàn thông tin trong môi trường đa phương tiện

94 23 0
Nghiên cứu phối hợp các phương pháp nén thông tin, mã hóa thông tin, giấu thông tin để đảm bảo an toàn thông tin trong môi trường đa phương tiện

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

ĐẠI HỌC QUỐC GIA HÀ NỘI TRƢỜNG ĐẠI HỌC CÔNG NGHỆ LÊ MẠNH THẮNG NGHIÊN CỨU PHỐI HỢP CÁC PHƢƠNG PHÁP NÉN THƠNG TIN, MÃ HỐ THƠNG TIN, GIẤU THƠNG TIN ĐỂ XÂY DỰNG ỨNG DỤNG GIẤU TIN TRONG MÔI TRƢỜNG ĐA PHƢƠNG TIỆN LUẬN VĂN THẠC SĨ Hà Nội - 2009 ĐẠI HỌC QUỐC GIA HÀ NỘI TRƢỜNG ĐẠI HỌC CÔNG NGHỆ LÊ MẠNH THẮNG NGHIÊN CỨU PHỐI HỢP CÁC PHƢƠNG PHÁP NÉN THƠNG TIN, MÃ HỐ THƠNG TIN, GIẤU THÔNG TIN ĐỂ XÂY DỰNG ỨNG DỤNG GIẤU TIN TRONG MƠI TRƢỜNG ĐA PHƢƠNG TIỆN Ngành: Cơng nghệ Thông tin Chuyên ngành: Công nghệ phần mềm Mã số: LUẬN VĂN THẠC SĨ NGƯỜI HƯỚNG DẪN KHOA HỌC TS Hồ Văn Hƣơng Hà Nội - 2009 LỜI CAM ĐOAN Tôi xin cam đoan kết đạt đƣợc luận văn sản phẩm riêng cá nhân, không chép lại ngƣời khác Trong toàn nội dung luận văn, điều đƣợc trình bày cá nhân đƣợc tổng hợp từ nhiều nguồn tài liệu Tất tài liệu tham khảo có xuất xứ rõ ràng đƣợc trích dẫn hợp pháp Tơi xin hồn tồn chịu trách nhiệm chịu hình thức kỷ luật theo quy định cho lời cam đoan Hà Nội, ngày tháng 11 năm 2009 Lê Mạnh Thắng LỜI CẢM ƠN Lời đầu tiên, tơi xin bày tỏ lịng biết ơn sâu sắc đến TS Hồ Văn Hƣơng – Ban yếu Chính phủ, ngƣời tận tình hƣớng dẫn, bảo giúp đỡ tơi suốt q trình nghiên cứu hồn thành luận văn Tơi xin chân thành cảm ơn thầy cô giáo trƣờng Đại học Công nghệ ĐHQG Hà Nội giảng dạy cung cấp cho chúng tơi kiến thức bổ ích thời gian học cao học, giúp tơi có tảng tri thức để phục vụ nghiên cứu khoa học sau Tôi xin cảm ơn Lãnh đạo đồng nghiệp đơn vị tạo điều kiện giúp đỡ tơi suốt q trình nghiên cứu hồn thành luận văn Tơi xin bày tỏ lịng cảm ơn đến gia đình bạn bè, ngƣời ln quan tâm, động viên khuyến khích tơi Hà Nội, ngày tháng 11 năm 2009 Học viên Lê Mạnh Thắng MỤC LỤC LỜI CAM ĐOAN LỜI CẢM ƠN MỤC LỤC DANH MỤC CÁC KÝ HIỆU VIẾT TẮT DANH MỤC CÁC HÌNH VẼ MỞ ĐẦU CHƢƠNG TỔNG QUAN VỀ NÉN, MÃ HOÁ VÀ GIẤU TIN MẬT 1.1 Tổng quan nén thông tin 1.1.1 Nhận thức chung 1.1.1.1 Một số khái niệm 1.1.1.2 Các thông số quan trọng nén 1.1.2 Nguyên tắc nén liệu 1.1.3 Phân loại phƣơng pháp nén 1.1.3.2 Theo cách thức thực nén 1.1.3.3 Phân loại dựa vào triết lý mã hoá 1.1.3.4 Cách phân loại Anil.K.Jain 1.1.4 Các kỹ thuật nén thông tin 1.1.4.2 Nén có mát thơng tin 1.1.5 Ứng dụng nén thông tin 1.2 Mã hố thơng tin 1.2.1 Sơ lƣợc lịch sử mật mã học 1.2.2 Các khái niệm 1.2.2.2 Khái niệm mã hoá thông tin 1.2.3 Phân loại hệ mật mã 1.2.3.1 Hệ mã hố khố bí mật 1.2.3.2 Hệ mã hoá khoá công khai 1.2.3.3 Kết hợp hệ mã hố khố bí mật hệ mã hố khố cơng khai 1.3 Sơ lƣợc giấu tin mật 1.3.1 Các khái niệm 1.3.1.1 Khái niệm giấu tin mật 1.3.1.2 Các thành phần hệ giấu tin mật 1.3.2 Tính chất giấu tin mật 1.3.3 Ứng dụng giấu tin mật 1.3.4 Kỹ thuật công hệ giấu tin mật 1.4 Kết chƣơng CHƢƠNG MÔI TRƢỜNG ĐA PHƢƠNG TIỆN VÀ KHẢ NĂNG GIẤU TIN 2.1 Âm số 2.1.1 Tính chất tín hiệu âm 2.1.2 Biểu diễn âm số 2.1.3 Nén âm 2.1.3.1 Lƣợng tử hóa phi tuyến 2.1.3.2 Mã hóa dự báo (Predictive Coding) 2.1.4 Giấu tin mật âm số 2.2.Ảnh số 2.2.1 Biểu diễn ảnh số 2.2.2 Các tham số ảnh số 2.2.3 Nén ảnh 2.2.4 Giấu tin mật ảnh số 2.2.4.1 Giấu tin mật ảnh đen trắng 2.2.4.2 Giấu tin ảnh màu 2.3.Video số 2.3.1 Biểu diễn video số 2.3.2 Nén video 2.3.2.2 Ƣớc lƣợng bù chuyển động 2.3.3 Giấu tin video số 2.4.Kết chƣơng CHƢƠNG PHỐI HỢP CÁC PHƢƠNG PHÁP NÉN, MÃ HOÁ VÀ GIẤU TIN ĐỂ XÂY DỰNG ỨNG DỤNG LIÊN LẠC BÍ MẬT 3.1.Vì phải kết hợp nén thơng tin, mã hố thơng tin gi 3.2.Tình hình nghiên cứu, ứng dụng giấu tin mật 3.2.1 Một số kỹ thuật phần mềm giấu tin mật thị trƣờng 3.2.2 Giấu tin mật nhu cầu liên lạc bí mật cơng tác An ninh Quốc phịng Việt Nam 55 3.3.Giải pháp đề xuất 3.3.1 Mục tiêu, yêu cầu 3.3.2 Giải pháp 3.4.Xây dựng cài đặt ứng dụng 3.4.1 Yêu cầu xây dựng 3.4.2 Lựa chọn giải pháp kỹ thuật cho ứng dụng 3.4.2.1 Lựa chọn môi trƣờng phƣơng tiện truyền 3.4.2.2 Xây dựng sở liệu vật mang 3.4.2.4 Lựa chọn phƣơng pháp mã hoá 3.4.2.6 Lựa chọn môi trƣờng xây dựng 3.4.3 Thiết kế cài đặt phần mềm 3.4.4 Kết xây dựng 3.4.5 Giới hạn cải thiện tƣơng lai: 3.5.Kết chƣơng KẾT LUẬN TÀI LIỆU THAM KHẢO PHỤ LỤC DANH MỤC CÁC KÝ HIỆU VIẾT TẮT VIẾT TẮT 3-DES ADC AES DAC DCT DES DPCM ECC HAS HVS JPEG LZ77, LZ78 LZW MNP5 PCM QAM RLC RLE RSA Hình vẽ Hình Hình Hình Hình Hình Hình Hình Hình Hình Hình 10 Hình 11 Hình 12 Hình 13 Hình 14 Hình 15 Hình 16 Hình 17 Hình 18 Hình 19 Hình 20 Hình 21 Hình 22 Hình 23 Hình 24 Hình 25 Hình 26 79 } return null; } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("ERROR: \n" + ex.Message); return null; } } Trong đó: khố key vecto ban đầu đƣợc lấy ngẫu nhiên Đoạn xử lý khóa AES nhƣ sau: / Doan xu ly khoa AES byte[] key = new byte[16]; byte[] iv = new byte[16]; //Sinh khoa va vecto ban dau ngau nhien //RNGCryptoServiceProvider is an implementation of a random number generator RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); rng.GetBytes(key); rng.GetBytes(iv); Nội dung thơng điệp đƣợc mã hố theo AES với khoá key vecto ban đầu iv private byte[] EncryptData(byte[] dataToEncrypt, byte[] rijnKey, byte[] rijnIV) { RijndaelManaged rijn = new RijndaelManaged(); //Get an encryptor ICryptoTransform encryptor = rijn.CreateEncryptor(rijnKey, rijnIV); //Encrypt the data MemoryStream msEncrypt = new MemoryStream(); CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write); //Write all data to the crypto stream and flush it csEncrypt.Write(dataToEncrypt, 0, dataToEncrypt.Length); csEncrypt.FlushFinalBlock(); } //Get encrypted array of bytes return msEncrypt.ToArray(); Mã hoá key iv AES giải thuật RSA với khóa cơng khai crptKey / ma hoa key va iv cua AES bang giai thuat RSA try { System.IO.StreamReader streamReader = new System.IO.StreamReader(crptKey, true); System.String xmlString = streamReader.ReadToEnd(); streamReader.Close(); System.Int32 index1 = xmlString.IndexOf(""); System.Int32 index2 = xmlString.IndexOf(""); System.Int32 keySize = System.Convert.ToInt32(xmlString.Substring(index1+ 9, (index2)-(index1+9)).Trim()); System.Security.Cryptography.RSACryptoServiceProvider RSAProvider = new System.Security.Cryptography.RSACryptoServiceProvider(keySize); System.Security.Cryptography.RSAParameters parameters = new System.Security.Cryptography.RSAParameters(); index1 = xmlString.IndexOf(""); index2 = xmlString.IndexOf(""); 80 System.String modulus = xmlString.Substring(index1 + 9, (index2) - (index1 + 9)).Trim(); parameters.Modulus = System.Convert.FromBase64String(modulus); index1 = xmlString.IndexOf(""); index2 = xmlString.IndexOf(""); System.String exponent = xmlString.Substring(index1 + 10, (index2) - (index1 + 10)).Trim(); parameters.Exponent = System.Convert.FromBase64String(exponent); RSAProvider.ImportParameters(parameters); / them phan kich thuoc khoa, khoa key va iv da ma bang RSA vao dau mang EncryptedBuf byte[] MBuf; Int16 keysize, tmpkeysize; keysize = (Int16)RSAProvider.Encrypt(key, true).Length; tmpkeysize = keysize; MBuf = new byte[EncryptedBuf.Length + + * keysize]; MBuf[1] = (byte)tmpkeysize;// lay byte thap tmpkeysize >>= 8; MBuf[0] = (byte)tmpkeysize;// lay byte cao Array.Copy(RSAProvider.Encrypt(key, true), 0, MBuf, 2, keysize); //lay key Array.Copy(RSAProvider.Encrypt(iv, true), 0, MBuf, keysize + 2, keysize);// lay iv Array.Copy(EncryptedBuf, 0, MBuf, * keysize + 2, EncryptedBuf.Length);// Tao xong thong diep theo cau truc: byte chi dai khoa, key, iv, thong diep da ma return MBuf; } catch (System.Security.Cryptography.CryptographicException CEx) { System.Windows.Forms.MessageBox.Show("ERROR: \nOne of the following has occured.\nThe cryptographic service provider cannot be acquired.\nThe length of the text being encrypted is greater than the maximum allowed length.\nThe OAEP padding is not supported on this computer.\n" + "Exact error: " + CEx.Message); } catch (System.Exception Ex) { System.Windows.Forms.MessageBox.Show("ERROR: \n" + Ex.Message); } } 4) Giấu tin theo giải thuật F5 public virtual void WriteCompressedData(System.IO.BufferedStream outStream) { int offset, i, j, r, c, a, b, temp = 0; int comp, xpos, ypos, xblockoffset, yblockoffset; float[][] inputArray; float[][] dctArray1 = new float[8][]; for (int i2 = 0; i2 < 8; i2++) { dctArray1[i2] = new float[8]; } double[][] dctArray2 = new double[8] []; for (int i3 = 0; i3 < 8; i3++) { dctArray2[i3] = new double[8]; } int[] dctArray3 = new int[8 * 8]; /* * Phương thức điều khiển việc nén ảnh * Bắt đầu từ góc trên, bên trái ảnh, nén khối 8x8 liệu toàn ảnh nén */ 81 int[] lastDCvalue = new int[JpegObj.NumberOfComponents]; int[] zeroArray = new int[64]; // initialized to hold all zeros int Width = 0, Height = 0; int nothing = 0, not; int MinBlockWidth, MinBlockHeight; / Cấu hình ban đầu MinBlockWidth MinBlockHeight thực để đảm bảo chúng bắt đầu với giá trị lớn giá trị thực chúng MinBlockWidth = ((imageWidth % != 0)?(int) (System.Math.Floor((double) imageWidth / 8.0) + 1) * 8:imageWidth); MinBlockHeight = ((imageHeight % != 0)?(int) (System.Math.Floor((double) imageHeight / 8.0) + 1) * 8:imageHeight); for (comp = 0; comp < JpegObj.NumberOfComponents; comp++) { MinBlockWidth = System.Math.Min(MinBlockWidth, JpegObj.BlockWidth[comp]); MinBlockHeight = System.Math.Min(MinBlockHeight, JpegObj.BlockHeight[comp]); } xpos = 0; / westfeld / Trước tiến hành lặp, khởi tạo hệ số coeff cho stg int shuffledIndex = 0; int coeffCount = 0; for (r = 0; r < MinBlockHeight; r++) { for (c = 0; c < MinBlockWidth; c++) { for (comp = 0; comp < JpegObj.NumberOfComponents; comp++) { for (i = 0; i < JpegObj.VsampFactor[comp]; i++) { for (j = 0; j < JpegObj.HsampFactor[comp]; j++) { coeffCount += 64; } } } } } int[] coeff = new int[coeffCount]; System.Console.Out.WriteLine("Bắt đầu lượng hoá DCT/quantisation"); System.Console.Out.WriteLine(imageWidth + " x " + imageHeight); for (r = 0; r < MinBlockHeight; r++) { for (c = 0; c < MinBlockWidth; c++) { xpos = c * 8; ypos = r * 8; for (comp = 0; comp < JpegObj.NumberOfComponents; comp++) { Width = JpegObj.BlockWidth[comp]; Height = JpegObj.BlockHeight[comp]; inputArray = (float[][]) JpegObj.Components[comp]; 82 for (i = 0; i < JpegObj.VsampFactor[comp]; i++) { JpegObj.HsampFactor[comp]; j++) for (j = 0; j < { xblockoffset = j * 8; yblockoffset = i * 8; for (a = 0; a < 8; a++) { for (b = 0; b < 8; b++) { dirty line fixed, Jun 2000 // westfeld int ia = ypos * JpegObj.VsampFactor[comp] + yblockoffset + a; int ib = xpos * JpegObj.HsampFactor[comp] + xblockoffset + b; if (imageHeight / * JpegObj.VsampFactor[comp] = 1; availableBitsToEmbed ; kBitsToEmbed |= nextBitToEmbed 0) extractedBit = coeff[codeWord[i]] & 1; else extractedBit = - (coeff[codeWord[i]] & 1); if (extractedBit == 1) hash ^= i + 1; } i = hash ^ kBitsToEmbed; if (i == 0) break; // nhúng mà khơng có thay đổi i ; if (coeff[codeWord[i]] > 0) coeff[codeWord[i]] ; else coeff[codeWord[i]]++; _changed++; if (coeff[codeWord[i]] == 0) _thrown++; } while (coeff[codeWord[i]] == 0); startOfN = endOfN; } while (!isLastByte); embeddingLoop_brk: ; } else { / Mã mặc định / Vịng lặp nhúng Nó hoạt động dịng hốn vị hệ số for (i = 0; i < coeffCount; i++) { shuffledIndex = permutation.getShuffled(i); if (shuffledIndex % 64 == 0) continue; // bỏ qua hệ số DC if (coeff[shuffledIndex] == 0) continue; // bỏ qua hệ số _examined++; if (coeff[shuffledIndex] > 0) { if ((coeff[shuffledIndex] & 1) != nextBitToEmbed) tuyệt đối { coeff[shuffledIndex] ; // giảm giá trị _changed++; } } else { if ((coeff[shuffledIndex] & 1) == nextBitToEmbed) { 88 coeff[shuffledIndex]++; // giảm giá trị tuyệt đối _changed++; } } if (coeff[shuffledIndex] != 0) { Hệ số khác Chúng ta nhúng thành công "nextBitToEmbed" Chúng ta đọc bit để nhúng bây / / / if (availableBitsToEmbed == 0) { // Nếu byte văn nhúng rỗng, nhận try { long available3; available3 = embeddedData.Length - embeddedData.Position; if ((int) available3 == 0) break; byteToEmbed = embeddedData.ReadByte(); byteToEmbed ^= random.NextByte; } catch (System.Exception e) { SupportClass.WriteStackTrace(e, Console.Error); } break; } availableBitsToEmbed = 8; nextBitToEmbed = byteToEmbed & 1; } else byteToEmbed >>= 1; availableBitsToEmbed ; _embedded++; _thrown++; } } if (_examined > 0) System.Console.Out.WriteLine(_examined + " hệ số kiểm tra"); System.Console.Out.WriteLine(_changed + " hệ số thay đổi(hiệu quả: " + (_embedded / _changed) + "." + (((_embedded * 10) / _changed) % 10) + " bits thay đổi)"); System.Console.Out.WriteLine(_thrown + " hệ số bỏ qua (tức nhận giá trị 0)"); System.Console.Out.WriteLine(_embedded + " bits (" + _embedded / + " bytes) nhúng"); } System.Console.Out.WriteLine("bat dau ma Huffman"); / Thuc hien ma hoa Huffman shuffledIndex = 0; for (r = 0; r < MinBlockHeight; r++) { for (c = 0; c < MinBlockWidth; c++) { 89 for (comp = 0; comp < JpegObj.NumberOfComponents; comp++) { for (i = 0; i < JpegObj.VsampFactor[comp]; i++) { for (j = 0; j < JpegObj.HsampFactor[comp]; j++) { Array.Copy(coeff, shuffledIndex, dctArray3, 0, 64); Huf.HuffmanBlockEncoder(outStream, dctArray3, lastDCvalue[comp], JpegObj.DCtableNumber[comp], JpegObj.ACtableNumber[comp]); lastDCvalue[comp] = dctArray3[0]; } } } shuffledIndex += 64; } } Huf.flushBuffer(outStream); System.Console.Out.WriteLine("\Ket thuc !"); } 5) Tách thông tin giấu public Extract(String filesrc,String embfilename,string pass) { embFileName = "output.txt"; embFileName = embfilename; password = "abc123"; password = pass; f = new System.IO.FileInfo(filesrc); try { carrier = new sbyte[(int)SupportClass.FileLength(f)]; System.IO.FileStream fis = new System.IO.FileStream(f.FullName, System.IO.FileMode.Open, System.IO.FileAccess.Read); fos = new System.IO.FileStream(new System.IO.FileInfo(embFileName).FullName, System.IO.FileMode.Create); SupportClass.ReadInput(fis, carrier, 0, carrier.Length); HuffmanDecode hd = new HuffmanDecode(carrier); System.Console.Out.WriteLine("Bat dau ma Huffman"); coeff = hd.decode(); System.Console.Out.WriteLine("Bat dau hoan vi"); System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); F5Random random = new F5Random(encoding.GetBytes(password)); Permutation permutation = new Permutation(coeff.Length, random); int extractedByte = 0; int availableExtractedBits = 0; int extractedFileLength = 0; int nBytesExtracted = 0; int shuffledIndex = 0; int extractedBit; int i2; // tric xuat chieu dai thong tin 90 for (i2 = 0; availableExtractedBits < 32; i2++) { shuffledIndex = permutation.getShuffled(i2); if (shuffledIndex % 64 == 0) continue; // bo qua cac he so DC shuffledIndex = shuffledIndex - (shuffledIndex % 64) + deZigZag[shuffledIndex % 64]; if (coeff[shuffledIndex] == 0) continue; // bo qua cac gia tri zero if (coeff[shuffledIndex] > 0) extractedBit = coeff[shuffledIndex] & 1; else extractedBit = - (coeff[shuffledIndex] & 1); extractedFileLength |= extractedBit > i2) & 1) 0) extractedBit = coeff[shuffledIndex] & 1; else extractedBit = - (coeff[shuffledIndex] & 1); extractedByte |= extractedBit

Ngày đăng: 11/11/2020, 22:03

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan