-\versionid $Id: pageant.but,v 1.5 2001/11/25 17:32:39 simon Exp $
+\versionid $Id: pageant.but,v 1.6 2001/12/11 18:48:29 simon Exp $
\C{pageant} Using Pageant for authentication
+\cfg{winhelp-topic}{pageant.general}
+
Pageant is an SSH authentication agent. It holds your private keys
in memory, already decoded, so that you can use them often without
needing to type a passphrase.
\k{pubkey} to find out how to generate and use one.
When you run Pageant, it will put an icon of a computer wearing a
-hat into the System tray. It will then sit and do nothing.
+hat into the System tray. It will then sit and do nothing, until you
+load a private key into it.
If you click the Pageant icon with the right mouse button, you will
see a menu. Select \q{View Keys} from this menu. The Pageant main
The Pageant window contains a list box. This shows the private keys
Pageant is holding. When you start Pageant, it has no keys, so the
-list box will be empty.
+list box will be empty. After you add one or more keys, they will
+show up in the list box.
To add a key to Pageant, press the \q{Add Key} button. Pageant will
bring up a file dialog, labelled \q{Select Private Key File}. Find
Pageant icon in the System tray, and select \q{Exit} from the menu.
Closing the Pageant main window does \e{not} shut down Pageant.
+\H{pageant-mainwin} The Pageant main window
+
+The Pageant main window appears when you left-click on the Pageant
+system tray icon, or alternatively right-click and select \q{View
+Keys} from the menu. You can use it to keep track of what keys are
+currently loaded into Pageant, and to add new ones or remove the
+existing keys.
+
+\S{pageant-mainwin-keylist} The key list box
+
+\cfg{winhelp-topic}{pageant.keylist}
+
+The large list box in the Pageant main window lists the private keys
+that are currently loaded into Pageant. The list might look
+something like this:
+
+\c ssh1 1024 22:c3:68:3b:09:41:36:c3:39:83:91:ae:71:b2:0f:04 key1
+\c ssh-rsa 1023 74:63:08:82:95:75:e1:7c:33:31:bb:cb:00:c0:89:8b key2
+
+For each key, the list box will tell you:
+
+\b The type of the key. Currently, this can be \c{ssh1} (an RSA key
+for use with the SSH v1 protocol), \c{ssh-rsa} (an RSA key for use
+with the SSH v2 protocol), or \c{ssh-dss} (a DSA key for use with
+the SSH v2 protocol).
+
+\b The size (in bits) of the key.
+
+\b The fingerprint for the public key. This should be the same
+fingerprint given by PuTTYgen, and (hopefully) also the same
+fingerprint shown by remote utilities such as \c{ssh-keygen} when
+applied to your \c{authorized_keys} file.
+
+\b The comment attached to the key.
+
+\S{pageant-mainwin-addkey} The \q{Add Key} button
+
+\cfg{winhelp-topic}{pageant.addkey}
+
+To add a key to Pageant by reading it out of a local disk file,
+press the \q{Add Key} button in the Pageant main window, or
+alternatively right-click on the Pageant icon in the system tray and
+select \q{Add Key} from there.
+
+Pageant will bring up a file dialog, labelled \q{Select Private Key
+File}. Find your private key file in this dialog, and press
+\q{Open}. If you want to add more than one key at once, you can
+select multiple files using Shift-click (to select several adjacent
+files) or Ctrl-click (to select non-adjacent files).
+
+Pageant will now load the private key(s). If a key is protected by a
+passphrase, Pageant will ask you to type the passphrase.
+
+(This is not the only way to add a private key to Pageant. You can
+also add one from a remote system by using agent forwarding; see
+\k{pageant-forward} for details.)
+
+\S{pageant-mainwin-remkey} The \q{Remove Key} button
+
+\cfg{winhelp-topic}{pageant.remkey}
+
+If you need to remove a key from Pageant, select that key in the
+list box, and press the \q{Remove Key} button. Pageant will remove
+the key from its memory.
+
+You can apply this to keys you added using the \q{Add Key} button,
+or to keys you added remotely using agent forwarding (see
+\k{pageant-forward}); it makes no difference.
+
\H{pageant-forward} Using agent forwarding
Agent forwarding is a mechanism that allows applications on your SSH
#include <tchar.h>
#include "ssh.h"
+#include "misc.h"
#include "tree234.h"
#define IDI_MAINICON 200
#define IDM_CLOSE 0x0010
#define IDM_VIEWKEYS 0x0020
#define IDM_ADDKEY 0x0030
-#define IDM_ABOUT 0x0040
+#define IDM_HELP 0x0040
+#define IDM_ABOUT 0x0050
#define APPNAME "Pageant"
extern char ver[];
static HINSTANCE instance;
-static HWND hwnd;
+static HWND main_hwnd;
static HWND keylist;
static HWND aboutbox;
static HMENU systray_menu;
static int already_running;
+static int requested_help;
+
+static char *help_path;
static tree234 *rsakeys, *ssh2keys;
*/
int random_byte(void)
{
- MessageBox(hwnd, "Internal Error", APPNAME, MB_OK | MB_ICONERROR);
+ MessageBox(main_hwnd, "Internal Error", APPNAME, MB_OK | MB_ICONERROR);
exit(0);
/* this line can't be reached but it placates MSVC's warnings :-) */
return 0;
*/
static void forget_passphrases(void)
{
- int i;
while (count234(passphrases) > 0) {
char *pp = index234(passphrases, 0);
memset(pp, 0, strlen(pp));
#else
of.lStructSize = sizeof(of);
#endif
- of.hwndOwner = hwnd;
+ of.hwndOwner = main_hwnd;
of.lpstrFilter = "All Files\0*\0\0\0";
of.lpstrCustomFilter = NULL;
of.nFilterIndex = 1;
rd.right - rd.left, rd.bottom - rd.top, TRUE);
}
+ if (help_path)
+ SetWindowLong(hwnd, GWL_EXSTYLE,
+ GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_CONTEXTHELP);
+ else {
+ HWND item = GetDlgItem(hwnd, 103); /* the Help button */
+ if (item)
+ DestroyWindow(item);
+ }
+ requested_help = FALSE;
+
keylist = hwnd;
{
static int tabs[] = { 35, 60, 210 };
keylist_update();
}
return 0;
+ case 103: /* help */
+ if (HIWORD(wParam) == BN_CLICKED ||
+ HIWORD(wParam) == BN_DOUBLECLICKED) {
+ if (help_path) {
+ WinHelp(main_hwnd, help_path, HELP_COMMAND,
+ (DWORD)"JI(`',`pageant.general')");
+ requested_help = TRUE;
+ }
+ }
+ return 0;
}
return 0;
+ case WM_HELP:
+ if (help_path) {
+ int id = ((LPHELPINFO)lParam)->iCtrlId;
+ char *cmd = NULL;
+ switch (id) {
+ case 100: cmd = "JI(`',`pageant.keylist')"; break;
+ case 101: cmd = "JI(`',`pageant.addkey')"; break;
+ case 102: cmd = "JI(`',`pageant.remkey')"; break;
+ }
+ if (cmd) {
+ WinHelp(main_hwnd, help_path, HELP_COMMAND, (DWORD)cmd);
+ requested_help = TRUE;
+ } else {
+ MessageBeep(0);
+ }
+ }
+ break;
case WM_CLOSE:
keylist = NULL;
DestroyWindow(hwnd);
SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
}
break;
+ case IDM_HELP:
+ if (help_path) {
+ WinHelp(main_hwnd, help_path, HELP_COMMAND,
+ (DWORD)"JI(`',`pageant.general')");
+ requested_help = TRUE;
+ }
+ break;
}
break;
case WM_DESTROY:
+ if (requested_help) {
+ WinHelp(main_hwnd, help_path, HELP_QUIT, 0);
+ requested_help = FALSE;
+ }
PostQuitMessage(0);
return 0;
case WM_COPYDATA:
instance = inst;
/*
+ * See if we can find our Help file.
+ */
+ {
+ char b[2048], *p, *q, *r;
+ FILE *fp;
+ GetModuleFileName(NULL, b, sizeof(b) - 1);
+ r = b;
+ p = strrchr(b, '\\');
+ if (p && p >= r) r = p+1;
+ q = strrchr(b, ':');
+ if (q && q >= r) r = q+1;
+ strcpy(r, "putty.hlp");
+ if ( (fp = fopen(b, "r")) != NULL) {
+ help_path = dupstr(b);
+ fclose(fp);
+ } else
+ help_path = NULL;
+ }
+
+ /*
* Find out if Pageant is already running.
*/
already_running = FALSE;
RegisterClass(&wndclass);
}
- hwnd = keylist = NULL;
+ main_hwnd = keylist = NULL;
- hwnd = CreateWindow(APPNAME, APPNAME,
- WS_OVERLAPPEDWINDOW | WS_VSCROLL,
- CW_USEDEFAULT, CW_USEDEFAULT,
- 100, 100, NULL, NULL, inst, NULL);
+ main_hwnd = CreateWindow(APPNAME, APPNAME,
+ WS_OVERLAPPEDWINDOW | WS_VSCROLL,
+ CW_USEDEFAULT, CW_USEDEFAULT,
+ 100, 100, NULL, NULL, inst, NULL);
/* Set up a system tray icon */
- AddTrayIcon(hwnd);
+ AddTrayIcon(main_hwnd);
systray_menu = CreatePopupMenu();
/* accelerators used: vkxa */
AppendMenu(systray_menu, MF_ENABLED, IDM_VIEWKEYS,
"&View Keys");
AppendMenu(systray_menu, MF_ENABLED, IDM_ADDKEY, "Add &Key");
+ AppendMenu(systray_menu, MF_SEPARATOR, 0, 0);
+ if (help_path)
+ AppendMenu(systray_menu, MF_ENABLED, IDM_HELP, "&Help");
AppendMenu(systray_menu, MF_ENABLED, IDM_ABOUT, "&About");
+ AppendMenu(systray_menu, MF_SEPARATOR, 0, 0);
AppendMenu(systray_menu, MF_ENABLED, IDM_CLOSE, "E&xit");
- ShowWindow(hwnd, SW_HIDE);
+ ShowWindow(main_hwnd, SW_HIDE);
/*
* Initialise storage for RSA keys.
NOTIFYICONDATA tnid;
tnid.cbSize = sizeof(NOTIFYICONDATA);
- tnid.hWnd = hwnd;
+ tnid.hWnd = main_hwnd;
tnid.uID = 1;
Shell_NotifyIcon(NIM_DELETE, &tnid);