private static List <Email> DecryptEmails(List <Email> encryptedEmails) { List <Email> decryptedEmails = new List <Email>(); foreach (Email encryptedEmail in encryptedEmails) { Email decryptedEmail = new Email(encryptedEmail.Seen, encryptedEmail.Sender, encryptedEmail.Subject, encryptedEmail.Date, encryptedEmail.Body, encryptedEmail.UId); decryptedEmail.Sender = EncryptService.Decrypt(encryptedEmail.Sender); decryptedEmail.Subject = EncryptService.Decrypt(encryptedEmail.Subject); decryptedEmail.Body = EncryptService.Decrypt(encryptedEmail.Body); decryptedEmails.Add(decryptedEmail); } return(decryptedEmails); }
private static List <Email> EncryptEmails(List <Email> unencryptedEmails) { List <Email> encryptedEmails = new List <Email>(); foreach (Email unencryptedEmail in unencryptedEmails) { Email encryptedEmail = new Email(unencryptedEmail.Seen, unencryptedEmail.Sender, unencryptedEmail.Subject, unencryptedEmail.Date, unencryptedEmail.Body, unencryptedEmail.UId); encryptedEmail.Sender = EncryptService.Encrypt(unencryptedEmail.Sender); encryptedEmail.Subject = EncryptService.Encrypt(unencryptedEmail.Subject); encryptedEmail.Body = EncryptService.Encrypt(unencryptedEmail.Sender); encryptedEmails.Add(encryptedEmail); } return(encryptedEmails); }