Skip to content

Commit

Permalink
Fixed #392 : Added an option to disable SSH key decryption progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
ExtraClock authored and dlech committed Dec 24, 2023
1 parent 9bf890e commit b1bad89
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 4 deletions.
4 changes: 2 additions & 2 deletions KeeAgent/ExtensionMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ static byte[] GetPassphrase(this PwEntry entry)
return Encoding.UTF8.GetBytes(passphrase);
}

public static ISshKey GetSshKey(this PwEntry entry)
public static ISshKey GetSshKey(this PwEntry entry, KeeAgentExt ext)
{
var settings = entry.GetKeeAgentSettings();

Expand All @@ -381,7 +381,7 @@ public static ISshKey GetSshKey(this PwEntry entry)
AsymmetricKeyParameter parameter;
var comment = string.Empty;

if (privateKey.HasKdf) {
if (privateKey.HasKdf && !ext.Options.DisableKeyDecryptionProgressBar) {
// if there is a key derivation function, decrypting could be slow,
// so show a progress dialog
var dialog = new DecryptProgressDialog();
Expand Down
5 changes: 4 additions & 1 deletion KeeAgent/KeeAgentExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public sealed partial class KeeAgentExt : Plugin
const string userPicksKeyOnRequestIdentitiesOptionName =
pluginNamespace + ".UserPicksKeyOnRequestIdentities";
const string ignoreMissingExternalKeyFilesName = pluginNamespace + ".IgnoreMissingExternalKeyFilesName";
const string disableKeyDecryptionProgressBarName = pluginNamespace + ".DisableKeyDecryptionProgressBar";
const string keyFilePathSprPlaceholder = @"{KEEAGENT:KEYFILEPATH}";
const string identFileOptSprPlaceholder = @"{KEEAGENT:IDENTFILEOPT}";
const string groupMenuItemName = "KeeAgentGroupMenuItem";
Expand Down Expand Up @@ -621,6 +622,7 @@ internal void SaveGlobalOptions()
config.SetBool(userPicksKeyOnRequestIdentitiesOptionName,
Options.UserPicksKeyOnRequestIdentities);
config.SetBool(ignoreMissingExternalKeyFilesName, Options.IgnoreMissingExternalKeyFiles);
config.SetBool(disableKeyDecryptionProgressBarName, Options.DisableKeyDecryptionProgressBar);
}

private void LoadOptions()
Expand All @@ -643,6 +645,7 @@ private void LoadOptions()
Options.UserPicksKeyOnRequestIdentities =
config.GetBool(userPicksKeyOnRequestIdentitiesOptionName, false);
Options.IgnoreMissingExternalKeyFiles = config.GetBool(ignoreMissingExternalKeyFilesName, false);
Options.DisableKeyDecryptionProgressBar = config.GetBool(disableKeyDecryptionProgressBarName, false);

string defaultLogFileNameValue = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
Expand Down Expand Up @@ -1053,7 +1056,7 @@ private void SprEngine_FilterCompile(object sender, SprEventArgs e)
var settings = entry.GetKeeAgentSettings();

try {
var key = entry.GetSshKey();
var key = entry.GetSshKey(this);
string db_name = "<Unknown database>";

try {
Expand Down
5 changes: 5 additions & 0 deletions KeeAgent/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,10 @@ public Options()
/// in the filesystem.
/// </summary>
public static bool IgnoreMissingExternalKeyFiles { get; set; }

/// <summary>
/// When <c>true</c>, we will not display a progress bar during SSH key decryption.
/// </summary>
public bool DisableKeyDecryptionProgressBar { get; set; }
}
}
10 changes: 9 additions & 1 deletion KeeAgent/Translatable.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions KeeAgent/Translatable.resx
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@
<data name="OptionIgnoreMissingExternalKeyFiles" xml:space="preserve">
<value>Ignore entries with missing external key files when automatically loading keys</value>
</data>
<data name="OptionDisableKeyDecryptionProgressBar" xml:space="preserve">
<value>Disable SSH key decryption progress bar</value>
</data>
<data name="LoadKeyOpenUrlContextMenuItem" xml:space="preserve">
<value>Load SS&amp;H Key and Open URL</value>
</data>
Expand Down
2 changes: 2 additions & 0 deletions KeeAgent/UI/OptionsPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public OptionsPanel(KeeAgentExt ext)
customListViewEx.Groups.Add(optionsGroup);
optionsList.CreateItem(ext.Options, "IgnoreMissingExternalKeyFiles",
optionsGroup, Translatable.OptionIgnoreMissingExternalKeyFiles);
optionsList.CreateItem(ext.Options, "DisableKeyDecryptionProgressBar",
optionsGroup, Translatable.OptionDisableKeyDecryptionProgressBar);

var agentModeOptionsGroup = new ListViewGroup("agentMode",
"Agent Mode Options (no effect in Client Mode)");
Expand Down
4 changes: 4 additions & 0 deletions doc/usage/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ tab.
external key files linked to password entries are missing. This option
is useful when you use the same KeePass database on multiple computers.


- **Disable SSH key decryption progress bar**: (default: disabled) Do not
show a progress bar during SSH key decryption process.

**Agent Mode Options** (no effect in *Client* mode)

These options only affect KeeAgent when running in *Agent* mode.
Expand Down

0 comments on commit b1bad89

Please sign in to comment.