public void storeData() { Crypter crypter = new Crypter(MasterPassword.Password); StringBuilder str = new StringBuilder(); foreach (ServiceLoginPassword slp in items) { str.Append($"{slp.ServiceName} : {slp.Login} : {slp.Password.Password}\n"); } byte[] encrypted = crypter.Encrypt(str.ToString()); byte[] salty = UsefulTools.ComputeSaltySHA256(Encoding.UTF8.GetBytes(str.ToString()), crypter.Salt); CryptoFile cryptoFile = new CryptoFile(encrypted, salty, crypter.IV, crypter.Salt); CryptoProtocol.Save(cryptoFile, store_path); }
private void Call_Empty_Store_Window(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog = FileDialog.CreateDefaultDialog(true); if (openFileDialog.ShowDialog() == true) { store_path = openFileDialog.FileName; EmptyStoreWindow emptyStoreWindow = new EmptyStoreWindow(); if (emptyStoreWindow.ShowDialog() == true) { Crypter crypter = new Crypter(emptyStoreWindow.Password.Password); byte[] encrypted = crypter.Encrypt(""); byte[] salty = UsefulTools.ComputeSaltySHA256(Encoding.UTF8.GetBytes(""), crypter.Salt); CryptoFile cryptoFile = new CryptoFile(encrypted, salty, crypter.IV, crypter.Salt); CryptoProtocol.Save(cryptoFile, store_path); Window window = new MainWindow(emptyStoreWindow.Password, new List <ServiceLoginPassword>(), store_path); window.Show(); this.Close(); return; } } }