Exemplo n.º 1
0
        public bool ValidatePassword(SecureString password)
        {
            var content = File.ReadAllText(_dataStore.MasterPasswordFile, Encoding.UTF8);

            content = FileSecurity.Decrypt(content, password);
            if (content == null)
            {
                return(false);
            }

            var hash = FileSecurity.GetHashString(FileSecurity.ConvertToUnSecureString(password));

            if (!content.Equals(hash))
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 2
0
        public void EnableSecureNotes(SecureString pass)
        {
            if (SecureNotesEnabled)
            {
                return;
            }

            var content       = FileSecurity.GetHashString(FileSecurity.ConvertToUnSecureString(pass));
            var encryptedPass = Encrypt(content, pass);

            File.WriteAllText(_dataStore.MasterPasswordFile, encryptedPass, Encoding.UTF8);

            IsAuthenticated    = true;
            SecureNotesEnabled = true;
            StorePassword(pass);

            //foreach (Note n in GetAllNotes())
            //	n.Save();
        }