1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-03-28 17:27:08 -05:00

winpgnt: menu options to delete/reencrypt everything.

Now the systray menu includes 'Remove All Keys' and 'Re-encrypt All
Keys' options, which do exactly what they say on the tin.
This commit is contained in:
Simon Tatham 2021-04-04 10:02:24 +01:00
parent 39a72c16cd
commit b8374f1bdf
3 changed files with 33 additions and 3 deletions

View File

@ -1408,6 +1408,19 @@ bool pageant_reencrypt_nth_ssh2_key(int i)
return reencrypt_key(pk);
}
void pageant_delete_all(void)
{
remove_all_keys(1);
remove_all_keys(2);
}
void pageant_reencrypt_all(void)
{
PageantKey *pk;
for (int i = 0; (pk = index234(keytree, i)) != NULL; i++)
reencrypt_key(pk);
}
/* ----------------------------------------------------------------------
* The agent plug.
*/

View File

@ -121,6 +121,8 @@ int pageant_count_ssh2_keys(void);
bool pageant_delete_nth_ssh1_key(int i);
bool pageant_delete_nth_ssh2_key(int i);
bool pageant_reencrypt_nth_ssh2_key(int i);
void pageant_delete_all(void);
void pageant_reencrypt_all(void);
/*
* This callback must be provided by the Pageant front end code.

View File

@ -67,9 +67,11 @@ static filereq *keypath = NULL;
#define IDM_VIEWKEYS 0x0020
#define IDM_ADDKEY 0x0030
#define IDM_ADDKEY_ENCRYPTED 0x0040
#define IDM_HELP 0x0050
#define IDM_ABOUT 0x0060
#define IDM_PUTTY 0x0070
#define IDM_REMOVE_ALL 0x0050
#define IDM_REENCRYPT_ALL 0x0060
#define IDM_HELP 0x0070
#define IDM_ABOUT 0x0080
#define IDM_PUTTY 0x0090
#define IDM_SESSIONS_BASE 0x1000
#define IDM_SESSIONS_MAX 0x2000
#define PUTTY_REGKEY "Software\\SimonTatham\\PuTTY\\Sessions"
@ -1175,6 +1177,14 @@ static LRESULT CALLBACK TrayWndProc(HWND hwnd, UINT message,
}
prompt_add_keyfile(command == IDM_ADDKEY_ENCRYPTED);
break;
case IDM_REMOVE_ALL:
pageant_delete_all();
keylist_update();
break;
case IDM_REENCRYPT_ALL:
pageant_reencrypt_all();
keylist_update();
break;
case IDM_ABOUT:
if (!aboutbox) {
aboutbox = CreateDialog(hinst, MAKEINTRESOURCE(IDD_ABOUT),
@ -1573,6 +1583,11 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
AppendMenu(systray_menu, MF_ENABLED, IDM_ADDKEY_ENCRYPTED,
"Add key (encrypted)");
AppendMenu(systray_menu, MF_SEPARATOR, 0, 0);
AppendMenu(systray_menu, MF_ENABLED, IDM_REMOVE_ALL,
"Remove All Keys");
AppendMenu(systray_menu, MF_ENABLED, IDM_REENCRYPT_ALL,
"Re-encrypt All Keys");
AppendMenu(systray_menu, MF_SEPARATOR, 0, 0);
if (has_help())
AppendMenu(systray_menu, MF_ENABLED, IDM_HELP, "&Help");
AppendMenu(systray_menu, MF_ENABLED, IDM_ABOUT, "&About");