private void ValidateLoginDetails() { byte[] key = keyClass.GetPrivateKey(_aesEncrypt); byte[] iv = keyClass.GetIV(_aesEncrypt); using (FileStream fStream = new FileStream(tempDir + "LoginDetails.csv", FileMode.Open)) { using (CryptoStream cStream = new CryptoStream(fStream, new AesManaged().CreateDecryptor(key, iv), CryptoStreamMode.Read)) { using (StreamReader reader = new StreamReader(cStream)) { String line; while ((line = reader.ReadLine()) != null) { if (line.Contains(",")) { String[] split = line.Split(','); if (split[0] == usernameTextBox.Text && split[1] == passwordTextBox.Text) { BookControl bookControl = new BookControl(_aesEncrypt); bookControl.Show(); this.Hide(); } else { MessageBox.Show("Invaild Please enter details again", "Error", MessageBoxButtons.OK); } } } } } } }
public UpdateBook(ListViewItem item, BookControl bookCtrl, AesCryptoServiceProvider aesEncrypt) { InitializeComponent(); _bookControl = bookCtrl; _aesEncrypt = aesEncrypt; _itemId = item; PopulateFields(); }
public AddBook(BookControl bookCtrl, AesCryptoServiceProvider aesEncrypt) { InitializeComponent(); _bookControl = bookCtrl; _aesEncrypt = aesEncrypt; _key = keyClass.GetPrivateKey(_aesEncrypt); _iv = keyClass.GetIV(_aesEncrypt); }