/// <summary> /// Encrypts and writes the UserInformationCollection to the file. /// </summary> public void SaveData() { string plaintext = string.Empty; var path = Display.Resource; Security.AES AES_SecurityPackage = new Security.AES(EncryptionKey, InitilizationVector); foreach (UserInformation information in UserInformationCollection) { plaintext += information.Description + " " + information.Password + Environment.NewLine; } byte[] cipherText = AES_SecurityPackage.Encrypt(plaintext); File.WriteAllText(path, Encoding.Default.GetString(cipherText)); }