Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #392 : Added an option to disable SSH key decryption progress bar #395

Merged
merged 3 commits into from
Dec 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of passing the entire extension, can we just have a boolean parameter for enabling/disabling UI?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dlech , sure

{
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 @@ -617,6 +618,7 @@ internal void SaveGlobalOptions()
config.SetBool(userPicksKeyOnRequestIdentitiesOptionName,
Options.UserPicksKeyOnRequestIdentities);
config.SetBool(ignoreMissingExternalKeyFilesName, Options.IgnoreMissingExternalKeyFiles);
config.SetBool(disableKeyDecryptionProgressBarName, Options.DisableKeyDecryptionProgressBar);
}

private void LoadOptions()
Expand All @@ -639,6 +641,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 @@ -1048,7 +1051,7 @@ public ISshKey AddEntry(PwEntry entry,
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.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be helpful to mention that the UI will still be frozen/unresponsive while the keys are being decrypted.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dlech , done


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

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