1 / 9

Lec6(Practical) Computer Security

Lec6(Practical) Computer Security. Encryption التشفير. خوارزمية DES. DES (Data Encryption Standard) AES (Advanced Encryption Standard) هي النسخة التالية لـ ( DES ) البرنامجين التاليين يستخدمان الدوال الخاصة بخوارزمية DES والموجودة في VB.NET

eithne
Download Presentation

Lec6(Practical) Computer Security

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lec6(Practical)Computer Security Encryption التشفير

  2. خوارزمية DES • DES (Data Encryption Standard) • AES (Advanced Encryption Standard)هي النسخة التالية لـ (DES) • البرنامجين التاليين يستخدمان الدوال الخاصة بخوارزمية DES والموجودة في VB.NET • البرنامج الأول يقوم بعملية التشفير للملف file1_plaintext.txt في ملف جديد file2_encryptedtext.txt

  3. خوارزمية DES • البرنامج الثاني يقوم بعملية فك التشفير من على الملف file2_encryptedtext.txt في ملف جديد file3_decryptedtext.txt

  4. خوارزمية DES(البرنامج الأول) Imports System.Security.Cryptography Imports Microsoft Module Module1 Sub Main() Dim sourcefile As String = "f:\\ file1_plaintext.txt " Dim destfile As String = "f:\\ file2_encryptedtext.txt " Dim deskey As Byte() = {100, 55, 6, 24, 86, 206, 90, 176} Dim desiv As Byte() = {45, 76, 45, 97, 243, 68, 101, 76} Dim fin As New System.IO.FileStream(sourcefile, IO.FileMode.Open, IO.FileAccess.Read) Dim fout As New System.IO.FileStream(destfile, IO.FileMode.OpenOrCreate, IO.FileAccess.Write) Dim bin(4096) As Byte Dim rdlen As Long = 0 Dim totlen As Long = fin.Length Dim len As Integer

  5. خوارزمية DES(البرنامج الأول) Dim des As New DESCryptoServiceProvider() Dim decSstrem As New CryptoStream(fout, des.CreateEncryptor(deskey, desiv), CryptoStreamMode.Write) While rdlen < totlen len = fin.Read(bin, 0, 4096) MsgBox(len) decSstrem.Write(bin, 0, len) rdlen = Convert.ToInt32(rdlen + len / des.BlockSize * des.BlockSize) End While decSstrem.Close() fout.Close() fin.Close() End Sub End Module

  6. خوارزمية AES(البرنامج الثاني) Imports System.Security.Cryptography Module Module1 Sub Main() Dim sourcefile As String = "f:\\ file2_encryptedtext.txt " Dim destfile As String = "f:\\ file3_decryptedtext.txt " Dim deskey As Byte() = {100, 55, 6, 24, 86, 206, 90, 176} Dim desiv As Byte() = {45, 76, 45, 97, 243, 68, 101, 76} Dim fin As New System.IO.FileStream(sourcefile, IO.FileMode.Open, IO.FileAccess.Read) Dim fout As New System.IO.FileStream(destfile, IO.FileMode.OpenOrCreate, IO.FileAccess.Write) Dim bin(4096) As Byte Dim rdlen As Long = 0 Dim totlen As Long = fin.Length Dim len As Integer

  7. خوارزمية AES(البرنامج الثاني) Dim des As New DESCryptoServiceProvider() Dim decSstrem As New CryptoStream(fout, des.CreateDecryptor(deskey, desiv), CryptoStreamMode.Write) While rdlen < totlen len = fin.Read(bin, 0, 4096) MsgBox(len) decSstrem.Write(bin, 0, len) rdlen = Convert.ToInt32(rdlen + len / des.BlockSize * des.BlockSize) End While decSstrem.Close() fout.Close() fin.Close() End Sub End Module

  8. خوارزمية DES • قومي بإنشاء الملف الأول file1_plaintext.txt وأدخلي فيه أي نص • قومي بتنفيذ البرنامج الأول لإنشاء الملف المشفر file2_encryptedtext.txt • ومن ثم قومي بتنفيذ البرنامج الثاني لإنشاء الملف غير المشفر file3_decryptedtext.txt

  9. End

More Related