信息安全實驗報告信息安全概論課程設(shè)計.doc_第1頁
信息安全實驗報告信息安全概論課程設(shè)計.doc_第2頁
信息安全實驗報告信息安全概論課程設(shè)計.doc_第3頁
信息安全實驗報告信息安全概論課程設(shè)計.doc_第4頁
信息安全實驗報告信息安全概論課程設(shè)計.doc_第5頁
已閱讀5頁,還剩8頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)

文檔簡介

鄭州輕工業(yè)學(xué)院課程設(shè)計報告名稱:信息安全概論指導(dǎo)教師:吉星、程立輝姓名:符豪學(xué)號:541307030112班級:網(wǎng)絡(luò)工程13-011. 目的 數(shù)據(jù)加密技術(shù)要求只有在指定的用戶或網(wǎng)絡(luò)下,才能解除密碼而獲得原來的數(shù)據(jù),這就需要給數(shù)據(jù)發(fā)送方和接受方以一些特殊的信息用于加解密,這就是所謂的密鑰。其密鑰的值是從大量的隨機數(shù)中選取的。按加密算法分為專用密鑰和公開密鑰兩種。數(shù)據(jù)加密技術(shù)是網(wǎng)絡(luò)中最基本的安全技術(shù),主要是通過對網(wǎng)絡(luò)中傳輸?shù)男畔⑦M行數(shù)據(jù)加密來保障其安全性,這是一種主動安全防御策略,用很小的代價即可為信息提供相當(dāng)大的安全保護。2. 題目使用C#編程語言,進行數(shù)據(jù)的加密與解密。系統(tǒng)基本功能描述如下:1、 實現(xiàn)DES算法加密與解密功能。2、 實現(xiàn)TripleDES算法加密與解密功能。3、 實現(xiàn)MD5算法加密功能。4、 實現(xiàn)RC2算法加密與解密功能。5、 實現(xiàn)TripleDES算法加密與解密功能。6、 實現(xiàn)RSA算法加密與解密功能。3. 功能描述使用該軟件在相應(yīng)的文本框中輸入明文,然后點擊加密就會立即轉(zhuǎn)化成相應(yīng)的密文,非常迅速和方便,而且操作簡單加流暢,非常好用。4. 需求分析加密軟件發(fā)展很快,目前最常見的是透明加密,透明加密是一種根據(jù)要求在操作系統(tǒng)層自動地對寫入存儲介質(zhì)的數(shù)據(jù)進行加密的技術(shù)。透明加密軟件作為一種新的數(shù)據(jù)保密手段,自2005年上市以來,得到許多軟件公司特別是制造業(yè)軟件公司和傳統(tǒng)安全軟件公司的熱捧,也為廣大需要對敏感數(shù)據(jù)進行保密的客戶帶來了希望。加密軟件上市以來,市場份額逐年上升,同時,經(jīng)過幾年的實踐,客戶對軟件開發(fā)商提出了更多的要求。與加密軟件產(chǎn)品剛上市時前一兩年各軟件廠商各持一詞不同,經(jīng)過市場的幾番磨煉,客戶和廠商對透明加密軟件有了更加統(tǒng)一的認(rèn)識。5. 設(shè)計說明傳統(tǒng)的周邊防御,比如防火墻、入侵檢測和防病毒軟件,已經(jīng)不再能夠解決很多今天的數(shù)據(jù)保護問題。為了加強這些防御措施并且滿足短期相關(guān)規(guī)范的要求,許多公司對于數(shù)據(jù)安全紛紛采取了執(zhí)行多點產(chǎn)品的戰(zhàn)術(shù)性措施。這種片面的部署計劃確實可以為他們的數(shù)據(jù)提供一點點額外的保護,但是在管理上花費昂貴并且操作困難,這種做法并不能為未來的發(fā)展提供一個清晰的框架。加密是確保數(shù)據(jù)安全最重要的環(huán)節(jié)。必須確保數(shù)據(jù)加密而不是僅僅依賴一個防護基礎(chǔ)架構(gòu)。對數(shù)據(jù)進行加密可以讓數(shù)據(jù)不論是在網(wǎng)絡(luò)中活動、在數(shù)據(jù)庫和電腦中靜止或者在工作站中被使用的時候都能防患于未然。6. 源代碼主窗體: using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace WindowsFormsApplication1 public partial class Form1 : Form public Form1() InitializeComponent(); private void md5ToolStripMenuItem_Click(object sender, EventArgs e) md5 md51 = new md5(); md51.Show(); private void dES加密解密ToolStripMenuItem_Click(object sender, EventArgs e) des des1 = new des(); des1.Show(); private void rSA加密解密ToolStripMenuItem_Click(object sender, EventArgs e) rsa rsa1 = new rsa(); rsa1.Show(); private void 幫助ToolStripMenuItem_Click(object sender, EventArgs e) help h = new help(); h.Show(); Cryptography類:using System;using System.Security.Cryptography;using System.IO;using System.Text;using System.Globalization;using System.Xml.Linq;using System.Collections.Generic;namespace WindowsFormsApplication1 class Encrypter /DES默認(rèn)密鑰向量 private static byte DES_IV = 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF ; public static string EncryptByMD5(string input) MD5 md5Hasher = MD5.Create(); byte data = md5Hasher.ComputeHash(Encoding.UTF8.GetBytes(input); StringBuilder sBuilder = new StringBuilder(); for (int i = 0; i data.Length; i+) sBuilder.Append(datai.ToString(x2); return sBuilder.ToString(); public static string EncryptByDES(string input, string key) byte inputBytes = Encoding.UTF8.GetBytes(input); byte keyBytes = ASCIIEncoding.UTF8.GetBytes(key); byte encryptBytes = EncryptByDES(inputBytes, keyBytes, keyBytes); using (DES des = new DESCryptoServiceProvider() using (MemoryStream ms = new MemoryStream() using (CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(), CryptoStreamMode.Write) using (StreamWriter writer = new StreamWriter(cs) writer.Write(inputBytes); string result = Convert.ToBase64String(encryptBytes); return result; public static byte EncryptByDES(byte inputBytes, byte key, byte IV) DES des = new DESCryptoServiceProvider(); des.Key = key; des.IV = IV; string result = string.Empty; using (MemoryStream ms = new MemoryStream() using (CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(), CryptoStreamMode.Write) cs.Write(inputBytes, 0, inputBytes.Length); return ms.ToArray(); public static string DecryptByDES(string input, string key) byte inputBytes = Convert.FromBase64String(input); byte keyBytes = ASCIIEncoding.UTF8.GetBytes(key); byte resultBytes = DecryptByDES(inputBytes, keyBytes, keyBytes); string result = Encoding.UTF8.GetString(resultBytes); return result; public static byte DecryptByDES(byte inputBytes, byte key, byte iv) DESCryptoServiceProvider des = new DESCryptoServiceProvider(); des.Key = key; des.IV = iv; using (MemoryStream ms = new MemoryStream(inputBytes) using (CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(), CryptoStreamMode.Read) using (StreamReader reader = new StreamReader(cs) string result = reader.ReadToEnd(); return Encoding.UTF8.GetBytes(result); public static string EncryptString(string input, string sKey) byte data = Encoding.UTF8.GetBytes(input); using (DESCryptoServiceProvider des = new DESCryptoServiceProvider() des.Key = ASCIIEncoding.ASCII.GetBytes(sKey); des.IV = ASCIIEncoding.ASCII.GetBytes(sKey); ICryptoTransform desencrypt = des.CreateEncryptor(); byte result = desencrypt.TransformFinalBlock(data, 0, data.Length); return BitConverter.ToString(result); public static string DecryptString(string input, string sKey) string sInput = input.Split(-.ToCharArray(); byte data = new bytesInput.Length; for (int i = 0; i sInput.Length; i+) datai = byte.Parse(sInputi, NumberStyles.HexNumber); using (DESCryptoServiceProvider des = new DESCryptoServiceProvider() des.Key = ASCIIEncoding.ASCII.GetBytes(sKey); des.IV = ASCIIEncoding.ASCII.GetBytes(sKey); ICryptoTransform desencrypt = des.CreateDecryptor(); byte result = desencrypt.TransformFinalBlock(data, 0, data.Length); return Encoding.UTF8.GetString(result); public static string EncryptByRSA(string plaintext, string publicKey) UnicodeEncoding ByteConverter = new UnicodeEncoding(); byte dataToEncrypt = ByteConverter.GetBytes(plaintext); using (RSACryptoServiceProvider RSA = new RSACryptoServiceProvider() RSA.FromXmlString(publicKey); byte encryptedData = RSA.Encrypt(dataToEncrypt, false); return Convert.ToBase64String(encryptedData); public static string DecryptByRSA(string ciphertext, string privateKey) UnicodeEncoding byteConverter = new UnicodeEncoding(); using (RSACryptoServiceProvider RSA = new RSACryptoServiceProvider() RSA.FromXmlString(privateKey); byte encryptedData = Convert.FromBase64String(ciphertext); byte decryptedData = RSA.Decrypt(encryptedData, false); return byteConverter.GetString(decryptedData); public static string HashAndSignString(string plaintext, string privateKey) UnicodeEncoding ByteConverter = new UnicodeEncoding(); byte dataToEncrypt = ByteConverter.GetBytes(plaintext); using (RSACryptoServiceProvider RSAalg = new RSACryptoServiceProvider() RSAalg.FromXmlString(privateKey); /使用SHA1進行摘要算法,生成簽名 byte encryptedData = RSAalg.SignData(dataToEncrypt, new SHA1CryptoServiceProvider(); return Convert.ToBase64String(encryptedData); public static bool VerifySigned(string plaintext, string SignedData, string publicKey) using (RSACryptoServiceProvider RSAalg = new RSACryptoServiceProvider() RSAalg.FromXmlString(publicKey); UnicodeEncoding ByteConverter = new UnicodeEncoding(); byte dataToVerifyBytes = ByteConverter.GetBytes(plaintext); byte signedDataBytes = Convert.FromBase64String(SignedData); return RSAalg.VerifyData(dataToVerifyBytes, new SHA1CryptoServiceProvider(), signedDataBytes); public static KeyValuePair CreateRSAKey() RSACryptoServiceProvider RSA = new RSACryptoServiceProvider(); string privateKey = RSA.ToXmlString(true); string publicKey = RSA.ToXmlString(false); return new KeyValuePair(publicKey, privateKey); public static byte GetBytes(string input) string sInput = input.Split(-.ToCharArray(); byte inputBytes = new bytesInput.Length; for (int i = 0; i sInput.Length; i+) inputBytesi = byte.Parse(sInputi, NumberStyles.HexNumber); return inputBytes; using System;using System.Collections.Gen

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論