




已閱讀5頁,還剩8頁未讀, 繼續免費閱讀
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
鄭州輕工業學院課程設計報告名稱:信息安全概論指導教師:吉星、程立輝姓名:符豪學號:541307030112班級:網絡工程13-011. 目的 數據加密技術要求只有在指定的用戶或網絡下,才能解除密碼而獲得原來的數據,這就需要給數據發送方和接受方以一些特殊的信息用于加解密,這就是所謂的密鑰。其密鑰的值是從大量的隨機數中選取的。按加密算法分為專用密鑰和公開密鑰兩種。數據加密技術是網絡中最基本的安全技術,主要是通過對網絡中傳輸的信息進行數據加密來保障其安全性,這是一種主動安全防御策略,用很小的代價即可為信息提供相當大的安全保護。2. 題目使用C#編程語言,進行數據的加密與解密。系統基本功能描述如下:1、 實現DES算法加密與解密功能。2、 實現TripleDES算法加密與解密功能。3、 實現MD5算法加密功能。4、 實現RC2算法加密與解密功能。5、 實現TripleDES算法加密與解密功能。6、 實現RSA算法加密與解密功能。3. 功能描述使用該軟件在相應的文本框中輸入明文,然后點擊加密就會立即轉化成相應的密文,非常迅速和方便,而且操作簡單加流暢,非常好用。4. 需求分析加密軟件發展很快,目前最常見的是透明加密,透明加密是一種根據要求在操作系統層自動地對寫入存儲介質的數據進行加密的技術。透明加密軟件作為一種新的數據保密手段,自2005年上市以來,得到許多軟件公司特別是制造業軟件公司和傳統安全軟件公司的熱捧,也為廣大需要對敏感數據進行保密的客戶帶來了希望。加密軟件上市以來,市場份額逐年上升,同時,經過幾年的實踐,客戶對軟件開發商提出了更多的要求。與加密軟件產品剛上市時前一兩年各軟件廠商各持一詞不同,經過市場的幾番磨煉,客戶和廠商對透明加密軟件有了更加統一的認識。5. 設計說明傳統的周邊防御,比如防火墻、入侵檢測和防病毒軟件,已經不再能夠解決很多今天的數據保護問題。為了加強這些防御措施并且滿足短期相關規范的要求,許多公司對于數據安全紛紛采取了執行多點產品的戰術性措施。這種片面的部署計劃確實可以為他們的數據提供一點點額外的保護,但是在管理上花費昂貴并且操作困難,這種做法并不能為未來的發展提供一個清晰的框架。加密是確保數據安全最重要的環節。必須確保數據加密而不是僅僅依賴一個防護基礎架構。對數據進行加密可以讓數據不論是在網絡中活動、在數據庫和電腦中靜止或者在工作站中被使用的時候都能防患于未然。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默認密鑰向量 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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 初中古詩文賞析課教案:古詩文賞析活動設計與成果展示
- 語文課上的一次辯論活動經歷(8篇)
- 教育家精神在教育實踐中的轉化路徑與策略
- 讀書的樂趣與收獲作文5篇范文
- 小學階梯式數學教學模式研究
- 數字技術與產業結構升級對城市韌性的作用
- 建筑起重機械租賃協議
- 《運動原理與健身實踐課程教學大綱》
- 學校趣味運動會見聞作文(10篇)
- 九年級數學上冊小專題10解直角三角形的常見類型作業
- 應彩云幼兒園優質公開課:中班繪本活動《晚上》
- 新聞學概論ppt全套教學課件
- 2022更新國家開放大學電大本科《英語教學理論與實踐》2023-2024期末試題及答案(試卷代號:1366)
- 2022年中南大學網絡教育《公務員制度-》在線作業二及參考答案
- 急性有機磷中毒臨床治療指南
- WNS鍋爐產品制造工藝檢驗流程卡
- 稀土產業園建設項目建議書(參考范文)
- Q∕GDW 12166-2021 換流站直流類設備質量評級技術導則
- 型鍋爐高硫無煙煤煙氣袋式除塵濕式脫硫系統設計
- 《千克、克、噸》知識點歸納
- Z3040搖臂鉆床課程設計
評論
0/150
提交評論