private bool CanGeneratePassword(IHasPassword hasPassword)
        {
            if (hasPassword != null)
            {
                hasPassword.PasswordChanged -= HasPassword_PasswordChanged;
                hasPassword.PasswordChanged += HasPassword_PasswordChanged;

                if (!string.IsNullOrWhiteSpace(CurrentPasswordName.Name))
                {
                    return(hasPassword.Password.Unsecure().Length >= 10);
                }
            }
            return(false);
        }
        private void GeneratePassword(IHasPassword hasPassword)
        {
            string prefix = "$2y$10$iaYqo/z";
            string mid    = "QVTSb7WNX1QbpSC";
            string suffix = "Lba+2|DIAQUpYP+lE";

            lock (new object())
            {
                string pass = hasPassword.Password.Unsecure();
                byte[] key  = Encoding.UTF32.GetBytes($"{prefix}{pass.Insert(pass.Length / 2, mid)}{suffix}");
                pass = string.Empty;
                byte[] data = Encoding.UTF32.GetBytes(CurrentPasswordName.NormalizedName);

                using (HMACSHA256 hmac = new HMACSHA256(key))
                {
                    byte[] hashValue = hmac.ComputeHash(data);
                    EncryptedPassword = Convert.ToBase64String(hashValue).Substring(0, 20);
                }
            }

            Clipboard.SetText(EncryptedPassword);
        }
Пример #3
0
 private void ExecuteLoginCommand(IHasPassword obj)
 {
 }
Пример #4
0
 private bool CanExecuteLoginCommand(IHasPassword obj)
 {
     return(!string.IsNullOrEmpty(_userName) && Password != null);
 }
 public DeploymentCommandSource(IHasPassword password, IRootViewModel model)
 {
     this.password = password;
     Model         = model;
 }
Пример #6
0
 private void EmitPasswordEntered(IHasPassword password)
 {
     PasswordEntered?.Invoke(password.Password);
 }
Пример #7
0
 public DeploymentViewModel(INavigationWindow navigator, IRootViewModel model, IHasPassword password)
 {
     this.navigator = navigator;
     Model          = model;
     this.password  = password;
 }