diff --git a/pageant.c b/pageant.c index 83aa806e..44460743 100644 --- a/pageant.c +++ b/pageant.c @@ -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. */ diff --git a/pageant.h b/pageant.h index ed436452..fe6f2ff9 100644 --- a/pageant.h +++ b/pageant.h @@ -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. diff --git a/windows/winpgnt.c b/windows/winpgnt.c index 0eae0832..7c745ac2 100644 --- a/windows/winpgnt.c +++ b/windows/winpgnt.c @@ -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");