예제 #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);
        }
예제 #2
0
        public string Decrypt(string text, SecureString pass = null)
        {
            var password = pass ?? GetPassword();

            return(FileSecurity.Decrypt(text, password));
        }