public static void saveData(List <PreQuisite> Table) { StreamWriter PreqFile = new StreamWriter("prerequisite.txt"); CryptoSymmetric crypto = new CryptoDES(new byte[] { 158, 23, 64, 96, 57, 225, 36, 85 }); foreach (var item in Table) { var tempString = item.Course1.Id.ToString() + "\t" + item.Course2.Id.ToString() + "\t" + item.Status.ToString(); PreqFile.WriteLine(crypto.Encrypt(tempString)); } PreqFile.Close(); }
public static void saveData(List <Term> termTable) { StreamWriter termFile = new StreamWriter("term.txt"); CryptoSymmetric crypto = new CryptoDES(new byte[] { 158, 23, 64, 96, 57, 225, 36, 85 }); foreach (var item in termTable) { var tempString = item.TermNum.ToString() + "\t" + item.TermName.ToString(); termFile.WriteLine(crypto.Encrypt(tempString)); } termFile.Close(); }
public static void saveData(List <Course> CourseTable) { StreamWriter CourseFile = new StreamWriter("course.txt"); CryptoSymmetric crypto = new CryptoDES(new byte[] { 158, 23, 64, 96, 57, 225, 36, 85 }); foreach (var item in CourseTable) { var tempString = String.Format("{0}\t{1}\t{2}\t{3}", item.Id, item.ECT, item.Name, item.type); CourseFile.WriteLine(crypto.Encrypt(tempString)); } CourseFile.Close(); }
public static void saveData(List <Clerk> ClerkTable) { StreamWriter ClerkFile = new StreamWriter("clerk.txt"); CryptoSymmetric crypto = new CryptoDES(new byte[] { 158, 23, 64, 96, 57, 225, 36, 85 }); foreach (var item in ClerkTable) { var tempString = item.Id.ToString() + "\t" + item.FirstName.ToString() + "\t" + item.LastName.ToString() + "\t" + item.Password.ToString(); ClerkFile.WriteLine(crypto.Encrypt(tempString)); } ClerkFile.Close(); }
public static void saveData(List <TermCourseStudent> termCourseStudentTable) { StreamWriter termCourseStudentFile = new StreamWriter("termcoursestudent.txt"); CryptoSymmetric crypto = new CryptoDES(new byte[] { 158, 23, 64, 96, 57, 225, 36, 85 }); foreach (var item in termCourseStudentTable) { var tempString = item.Mark.ToString() + "\t" + item.AnswerToObjection.ToString() + "\t" + item.ObjectionToMark.ToString() + "\t" + item.TermCourse.Id.ToString() + "\t" + item.Student.Id.ToString() + "\t" + item.Status.ToString(); termCourseStudentFile.WriteLine(crypto.Encrypt(tempString)); } termCourseStudentFile.Close(); }
public static void saveData(List <TermCourse> termCourseTable) { StreamWriter file = new StreamWriter("termcourse.txt"); CryptoSymmetric crypto = new CryptoDES(new byte[] { 158, 23, 64, 96, 57, 225, 36, 85 }); foreach (var item in termCourseTable) { var tempString = item.Id.ToString() + "\t" + item.Course.Id.ToString() + "\t" + item.Term.TermNum.ToString() + "\t" + item.Teacher.Id.ToString() + "\t" + item.Time + "\t" + item.Place + "\t" + item.Capacity; file.WriteLine(crypto.Encrypt(tempString)); } file.Close(); }
public static void saveData(List <Student> studentTable) { StreamWriter file = new StreamWriter("student.txt"); CryptoSymmetric crypto = new CryptoDES(new byte[] { 158, 23, 64, 96, 57, 225, 36, 85 }); foreach (var item in studentTable) { var tempString = item.Id.ToString() + "\t" + item.FirstName.ToString() + "\t" + item.LastName.ToString() + "\t" + item.Password.ToString() + "\t" + item.EntranceYear; file.WriteLine(crypto.Encrypt(tempString)); } file.Close(); }
public void CryptoDES_RandomIV_Test() { //Arrange byte[] key = { 158, 23, 64, 96, 57, 225, 36, 85 }; CryptoSymmetric crypto = new CryptoDES(key); string originalMessage = "I love cryptography and DES with a 64-bits key"; string encryptedMessage = crypto.Encrypt(originalMessage); //Act string decryptedMessage = crypto.Decrypt(encryptedMessage); //Assert Assert.AreNotEqual(originalMessage, encryptedMessage); Assert.AreEqual(originalMessage, decryptedMessage); }
public void CryptoDES_FixedIV_Test() { //Arrange byte[] key = { 158, 23, 64, 96, 57, 225, 36, 85 }; byte[] iv = { 63, 208, 159, 46, 37, 77, 1, 59 }; CryptoSymmetric crypto = new CryptoDES(key); crypto.SetIV(iv); string originalMessage = "I love cryptography and DES with a 64-bits key"; string encryptedMessage = crypto.Encrypt(originalMessage); //Act string decryptedMessage = crypto.Decrypt(encryptedMessage); //Assert Assert.AreNotEqual(originalMessage, encryptedMessage); Assert.AreEqual(originalMessage, decryptedMessage); }