1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

Windows Pageant: configurable fingerprint type.

There's now a drop-down list box below the key list, from which you
can select a fingerprint type. Also, like GUI PuTTYgen, I've widened
the key list window to make room for wider SHA256 fingerprints.
This commit is contained in:
Simon Tatham 2021-03-13 10:05:43 +00:00
parent 43d70071b3
commit 911ead25e7
2 changed files with 39 additions and 8 deletions

View File

@ -24,17 +24,19 @@ BEGIN
PUSHBUTTON "&Cancel", IDCANCEL, 80, 42, 40, 14 PUSHBUTTON "&Cancel", IDCANCEL, 80, 42, 40, 14
END END
211 DIALOG DISCARDABLE 0, 0, 330, 200 211 DIALOG DISCARDABLE 0, 0, 450, 211
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Pageant Key List" CAPTION "Pageant Key List"
FONT 8, "MS Shell Dlg" FONT 8, "MS Shell Dlg"
BEGIN BEGIN
LISTBOX 100, 10, 10, 310, 155, LISTBOX 100, 10, 10, 420, 155,
LBS_EXTENDEDSEL | LBS_HASSTRINGS | LBS_USETABSTOPS | WS_VSCROLL | WS_TABSTOP LBS_EXTENDEDSEL | LBS_HASSTRINGS | LBS_USETABSTOPS | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Add Key", 101, 75, 162, 60, 14 PUSHBUTTON "&Add Key", 101, 75, 187, 60, 14
PUSHBUTTON "&Remove Key", 102, 195, 162, 60, 14 PUSHBUTTON "&Remove Key", 102, 315, 187, 60, 14
PUSHBUTTON "&Help", 103, 10, 182, 50, 14 PUSHBUTTON "&Help", 103, 10, 187, 50, 14
DEFPUSHBUTTON "&Close", IDOK, 270, 182, 50, 14 DEFPUSHBUTTON "&Close", IDOK, 390, 187, 50, 14
LTEXT "&Fingerprint type:", 104, 10, 172, 60, 8
COMBOBOX 105, 70, 170, 60, 12, CBS_DROPDOWNLIST
END END
/* Accelerators used: cl */ /* Accelerators used: cl */

View File

@ -63,6 +63,7 @@ static HWND keylist;
static HWND aboutbox; static HWND aboutbox;
static HMENU systray_menu, session_menu; static HMENU systray_menu, session_menu;
static bool already_running; static bool already_running;
static FingerprintType fptype = SSH_FPTYPE_DEFAULT;
static char *putty_path; static char *putty_path;
static bool restrict_putty_acl = false; static bool restrict_putty_acl = false;
@ -353,7 +354,7 @@ void keylist_update(void)
* stop and leave out a tab character. Urgh. * stop and leave out a tab character. Urgh.
*/ */
p = ssh2_fingerprint(skey->key, SSH_FPTYPE_DEFAULT); p = ssh2_fingerprint(skey->key, fptype);
listentry = dupprintf("%s\t%s", p, skey->comment); listentry = dupprintf("%s\t%s", p, skey->comment);
sfree(p); sfree(p);
@ -512,6 +513,14 @@ static INT_PTR CALLBACK KeyListProc(HWND hwnd, UINT msg,
RSAKey *rkey; RSAKey *rkey;
ssh2_userkey *skey; ssh2_userkey *skey;
static const struct {
const char *name;
FingerprintType value;
} fptypes[] = {
{"SHA256", SSH_FPTYPE_SHA256},
{"MD5", SSH_FPTYPE_MD5},
};
switch (msg) { switch (msg) {
case WM_INITDIALOG: { case WM_INITDIALOG: {
/* /*
@ -539,11 +548,21 @@ static INT_PTR CALLBACK KeyListProc(HWND hwnd, UINT msg,
keylist = hwnd; keylist = hwnd;
{ {
static int tabs[] = { 35, 75, 250 }; static int tabs[] = { 35, 75, 300 };
SendDlgItemMessage(hwnd, 100, LB_SETTABSTOPS, SendDlgItemMessage(hwnd, 100, LB_SETTABSTOPS,
sizeof(tabs) / sizeof(*tabs), sizeof(tabs) / sizeof(*tabs),
(LPARAM) tabs); (LPARAM) tabs);
} }
int selection = 0;
for (size_t i = 0; i < lenof(fptypes); i++) {
SendDlgItemMessage(hwnd, 105, CB_ADDSTRING,
0, (LPARAM)fptypes[i].name);
if (fptype == fptypes[i].value)
selection = (int)i;
}
SendDlgItemMessage(hwnd, 105, CB_SETCURSEL, 0, selection);
keylist_update(); keylist_update();
return 0; return 0;
} }
@ -632,6 +651,16 @@ static INT_PTR CALLBACK KeyListProc(HWND hwnd, UINT msg,
launch_help(hwnd, WINHELP_CTX_pageant_general); launch_help(hwnd, WINHELP_CTX_pageant_general);
} }
return 0; return 0;
case 105: /* fingerprint type */
if (HIWORD(wParam) == CBN_SELCHANGE) {
int selection = SendDlgItemMessage(
hwnd, 105, CB_GETCURSEL, 0, 0);
if (selection >= 0 && (size_t)selection < lenof(fptypes)) {
fptype = fptypes[selection].value;
keylist_update();
}
}
return 0;
} }
return 0; return 0;
case WM_HELP: { case WM_HELP: {