private void ReadDataFile() { var fileStream = new FileStream(DataFile, FileMode.Open); var binaryFormatter = new BinaryFormatter(); byte[] bytes = (byte[])binaryFormatter.Deserialize(fileStream); string str = Decrypt(bytes); bytes = Convert.FromBase64String(str); MemoryStream memStream = new MemoryStream(bytes); Data = (PasswordManagerData)binaryFormatter.Deserialize(memStream); fileStream.Close(); memStream.Close(); }
public PasswordManager() { Hasher = new PasswordHasher(); Data = new PasswordManagerData(); Timer = new Stopwatch(); Timer.Start(); IV = new byte[8]; Salt = new byte[8]; DirectoryInfo dir = Directory.CreateDirectory(Path); dir.Attributes = FileAttributes.Directory | FileAttributes.Hidden; if (!File.Exists(DataFile)) { using (File.Create(DataFile)) { } } InitializeRegistry(); }
public void Dispose() { Array.Clear(SessionId, 0, SessionId.Length); Data = null; }