Skip to content

Commit

Permalink
Use secure desktop when asking for SoftLock pin
Browse files Browse the repository at this point in the history
If "Enter master key on secure desktop" is active, secure desktop is also used by SoftLock
  • Loading branch information
Rookiestyle committed Jan 4, 2024
1 parent 1d27d48 commit 077e8d7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Rookiestyle")]
[assembly: AssemblyProduct("KeePass Plugin")]
[assembly: AssemblyCopyright("Copyright © 2021-2023")]
[assembly: AssemblyCopyright("Copyright © 2021-2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,5 +32,5 @@
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.5")]
[assembly: AssemblyFileVersion("3.5")]
[assembly: AssemblyVersion("3.6")]
[assembly: AssemblyFileVersion("3.6")]
42 changes: 28 additions & 14 deletions src/SoftLock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,22 +197,36 @@ private void OnTimerTick(object sender, EventArgs e)

private void DisableSoftlockUsingQU()
{
m_UnlockForm = new UnlockForm();
m_UnlockForm.Text = PluginTranslate.PluginName + " - Softlock";
if (m_UnlockForm.ShowDialog(Program.MainForm) == DialogResult.OK)
if (m_UnlockForm != null) m_UnlockForm.Dispose();

KeePassLib.Delegates.GFunc<UnlockForm> fConstruct = delegate()
{
ProtectedString CheckQuickUnlockKey = m_UnlockForm.QuickUnlockKey;
ProtectedString QuickUnlockKey = _qu.GetQuickUnlockKey(Program.MainForm.ActiveDatabase);
var lac = LockAssistConfig.GetQuickUnlockOptions(Program.MainForm.ActiveDatabase);
if ((QuickUnlockKey == null) || CheckQuickUnlockKey.Equals(_qu.TrimQuickUnlockKey(QuickUnlockKey, lac), false))
{
SetVisibility(true);
if (LockAssistConfig.SL_IsActive) m_SLTimer.Interval = LockAssistConfig.SL_Seconds * 1000;
}
else PluginDebug.AddError("Deactivate SoftLock", "Deactivation failed", "Invalid Quick Unlock key provided");
m_UnlockForm = new UnlockForm();
m_UnlockForm.Text = PluginTranslate.PluginName + " - Softlock";
return m_UnlockForm;
};

KeePassLib.Delegates.GFunc<UnlockForm, ProtectedString> fResultBuilder = delegate(UnlockForm f)
{
ProtectedString r = f.QuickUnlockKey;
UIUtil.DestroyForm(m_UnlockForm);
m_UnlockForm = null;
return r;
};

ProtectedString psCheckQuickUnlockKey = new ProtectedString();
DialogResult dr = Tools.ShowDialog(Program.Config.Security.MasterKeyOnSecureDesktop, fConstruct, fResultBuilder, out psCheckQuickUnlockKey);

if (dr != DialogResult.OK) return;

ProtectedString psQuickUnlockKey = _qu.GetQuickUnlockKey(Program.MainForm.ActiveDatabase);
var lacOptions = LockAssistConfig.GetQuickUnlockOptions(Program.MainForm.ActiveDatabase);
if ((psQuickUnlockKey == null) || psCheckQuickUnlockKey.Equals(_qu.TrimQuickUnlockKey(psQuickUnlockKey, lacOptions), false))
{
SetVisibility(true);
if (LockAssistConfig.SL_IsActive) m_SLTimer.Interval = LockAssistConfig.SL_Seconds * 1000;
}
if (m_UnlockForm != null) m_UnlockForm.Dispose();
m_UnlockForm = null;
else PluginDebug.AddError("Deactivate SoftLock", "Deactivation failed", "Invalid Quick Unlock key provided");
}

private void DisableSoftlockUsingFullPassword()
Expand Down
2 changes: 1 addition & 1 deletion version.info
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:
LockAssist:3.5
LockAssist:3.6
LockAssist!de:5
LockAssist!pt:4
LockAssist!zh:5
Expand Down

0 comments on commit 077e8d7

Please sign in to comment.