Beispiel #1
0
        private void keyCreateForm_onConfirmClick(object sender, EventArgs e)
        {
            if (!_createKeyForm_usePw.Checked)
            {
                return;
            }

            if (!_createKeyForm_pwInputGroup.ValidateData(false))
            {
                return;
            }

            // password should be used, passwords are equal and
            // yubikey is connected at this point in the code
            string challenge = Encoding.UTF8.GetString(_createKeyForm_pwInputGroup.GetPasswordUtf8());
            string response;

            if (yubiChallengeResponse(challenge, out response))
            {
                // workaround for harmless bug
                _backupUIFlags             = KeePass.Program.Config.UI.UIFlags;
                Program.Config.UI.UIFlags &= ~(ulong)KeePass.App.Configuration.AceUIFlags.HidePwQuality;
                _restoreUIFlags            = true;

                string password = deriveMasterPassword(challenge, response);
                _createKeyForm_pwInputGroup.SetPassword(Encoding.UTF8.GetBytes(password), true);

                new YubiPluginForm(password).ShowDialog();
            }
        }
Beispiel #2
0
        private void CreateNewPassword(PwProfile prof)
        {
            if (prof == null)
            {
                prof = PwProfile.DeriveFromPassword(m_pcadata.OldPassword);
            }
            if (prof.CollectUserEntropy && (m_pbEntropy == null))
            {
                m_pbEntropy = EntropyForm.CollectEntropyIfEnabled(prof);
            }
            ProtectedString psNew;

            PwGenerator.Generate(out psNew, prof, m_pbEntropy, Program.PwGeneratorPool);
            m_icgNewPassword.SetPassword(psNew, true);
        }