зеркало из https://github.com/github/putty.git
UI changes for key imports. We now have a separate Load command and
Import command; the former warns you if you load a foreign key, whereas the latter doesn't. So the user should always be aware, one way or the other, that a format conversion is taking place. [originally from svn r1687]
This commit is contained in:
Родитель
8cdae4f73b
Коммит
c92ea6c8ed
|
@ -1,4 +1,4 @@
|
||||||
\versionid $Id: pubkey.but,v 1.16 2002/05/16 22:36:36 jacob Exp $
|
\versionid $Id: pubkey.but,v 1.17 2002/05/18 09:20:41 simon Exp $
|
||||||
|
|
||||||
\C{pubkey} Using public keys for SSH authentication
|
\C{pubkey} Using public keys for SSH authentication
|
||||||
|
|
||||||
|
@ -330,17 +330,14 @@ find your key file. Once you select the file, PuTTYgen will ask you
|
||||||
for a passphrase (if necessary) and will then display the key
|
for a passphrase (if necessary) and will then display the key
|
||||||
details in the same way as if it had just generated the key.
|
details in the same way as if it had just generated the key.
|
||||||
|
|
||||||
PuTTYgen can also load SSH2 private keys in OpenSSH's format and
|
If you use the Load command to load a foreign key format, it will
|
||||||
\cw{ssh.com}'s format. Once you have loaded one of these key types,
|
work, but you will see a message box warning you that the key you
|
||||||
you can then save it back out as a PuTTY-format key so that you can
|
have loaded is not a PuTTY native key. See \k{puttygen-conversions}
|
||||||
use it with PuTTY. The passphrase will be unchanged by this process.
|
for information about importing foreign key formats.
|
||||||
You may want to change the key comment before you save the key,
|
|
||||||
since OpenSSH's SSH2 key format contains no space for a comment and
|
|
||||||
\cw{ssh.com}'s default comment format is long and verbose.
|
|
||||||
|
|
||||||
\S{puttygen-export} Exporting your private key in an alternative format
|
\S{puttygen-conversions} Dealing with private keys in other formats
|
||||||
|
|
||||||
\cfg{winhelp-topic}{puttygen.export}
|
\cfg{winhelp-topic}{puttygen.conversions}
|
||||||
|
|
||||||
Most SSH1 clients use a standard format for storing private keys on
|
Most SSH1 clients use a standard format for storing private keys on
|
||||||
disk. PuTTY uses this format as well; so if you have generated an
|
disk. PuTTY uses this format as well; so if you have generated an
|
||||||
|
@ -352,15 +349,25 @@ However, SSH2 private keys have no standard format. OpenSSH and
|
||||||
So a key generated with one client cannot immediately be used with
|
So a key generated with one client cannot immediately be used with
|
||||||
another.
|
another.
|
||||||
|
|
||||||
PuTTYgen has the ability to export private keys in OpenSSH format,
|
Using the \q{Import} command from the \q{Conversions} menu, PuTTYgen
|
||||||
or in \cw{ssh.com} format. To do so, select an option from the
|
can load SSH2 private keys in OpenSSH's format and \cw{ssh.com}'s
|
||||||
\q{Export} menu at the top of the PuTTYgen window. Exporting a key
|
format. Once you have loaded one of these key types, you can then
|
||||||
works exactly like saving it (see \k{puttygen-savepriv}) - you need
|
save it back out as a PuTTY-format key so that you can use it with
|
||||||
to have typed your passphrase in beforehand, and you will be warned
|
PuTTY. The passphrase will be unchanged by this process (unless you
|
||||||
if you are about to save a key without a passphrase.
|
deliberately change it). You may want to change the key comment
|
||||||
|
before you save the key, since OpenSSH's SSH2 key format contains no
|
||||||
|
space for a comment and \cw{ssh.com}'s default comment format is
|
||||||
|
long and verbose.
|
||||||
|
|
||||||
Note that the export options are only available if you have
|
PuTTYgen can also export private keys in OpenSSH format and in
|
||||||
generated an SSH2 key.
|
\cw{ssh.com} format. To do so, select one of the \q{Export} options
|
||||||
|
from the \q{Conversions} menu. Exporting a key works exactly like
|
||||||
|
saving it (see \k{puttygen-savepriv}) - you need to have typed your
|
||||||
|
passphrase in beforehand, and you will be warned if you are about to
|
||||||
|
save a key without a passphrase.
|
||||||
|
|
||||||
|
Note that since only SSH2 keys come in different formats, the export
|
||||||
|
options are not available if you have generated an SSH1 key.
|
||||||
|
|
||||||
\H{pubkey-gettingready} Getting ready for public key authentication
|
\H{pubkey-gettingready} Getting ready for public key authentication
|
||||||
|
|
||||||
|
|
43
puttygen.c
43
puttygen.c
|
@ -332,7 +332,7 @@ struct MainDlgState {
|
||||||
unsigned *entropy;
|
unsigned *entropy;
|
||||||
struct RSAKey key;
|
struct RSAKey key;
|
||||||
struct dss_key dsskey;
|
struct dss_key dsskey;
|
||||||
HMENU filemenu, keymenu, exportmenu;
|
HMENU filemenu, keymenu, cvtmenu;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void hidemany(HWND hwnd, const int *ids, int hideit)
|
static void hidemany(HWND hwnd, const int *ids, int hideit)
|
||||||
|
@ -539,9 +539,10 @@ void ui_set_state(HWND hwnd, struct MainDlgState *state, int status)
|
||||||
EnableMenuItem(state->keymenu, IDC_KEYSSH1, MF_ENABLED|MF_BYCOMMAND);
|
EnableMenuItem(state->keymenu, IDC_KEYSSH1, MF_ENABLED|MF_BYCOMMAND);
|
||||||
EnableMenuItem(state->keymenu, IDC_KEYSSH2RSA, MF_ENABLED|MF_BYCOMMAND);
|
EnableMenuItem(state->keymenu, IDC_KEYSSH2RSA, MF_ENABLED|MF_BYCOMMAND);
|
||||||
EnableMenuItem(state->keymenu, IDC_KEYSSH2DSA, MF_ENABLED|MF_BYCOMMAND);
|
EnableMenuItem(state->keymenu, IDC_KEYSSH2DSA, MF_ENABLED|MF_BYCOMMAND);
|
||||||
EnableMenuItem(state->exportmenu, IDC_EXPORT_OPENSSH,
|
EnableMenuItem(state->cvtmenu, IDC_IMPORT, MF_ENABLED|MF_BYCOMMAND);
|
||||||
|
EnableMenuItem(state->cvtmenu, IDC_EXPORT_OPENSSH,
|
||||||
MF_GRAYED|MF_BYCOMMAND);
|
MF_GRAYED|MF_BYCOMMAND);
|
||||||
EnableMenuItem(state->exportmenu, IDC_EXPORT_SSHCOM,
|
EnableMenuItem(state->cvtmenu, IDC_EXPORT_SSHCOM,
|
||||||
MF_GRAYED|MF_BYCOMMAND);
|
MF_GRAYED|MF_BYCOMMAND);
|
||||||
break;
|
break;
|
||||||
case 1: /* generating key */
|
case 1: /* generating key */
|
||||||
|
@ -563,9 +564,10 @@ void ui_set_state(HWND hwnd, struct MainDlgState *state, int status)
|
||||||
EnableMenuItem(state->keymenu, IDC_KEYSSH1, MF_GRAYED|MF_BYCOMMAND);
|
EnableMenuItem(state->keymenu, IDC_KEYSSH1, MF_GRAYED|MF_BYCOMMAND);
|
||||||
EnableMenuItem(state->keymenu, IDC_KEYSSH2RSA, MF_GRAYED|MF_BYCOMMAND);
|
EnableMenuItem(state->keymenu, IDC_KEYSSH2RSA, MF_GRAYED|MF_BYCOMMAND);
|
||||||
EnableMenuItem(state->keymenu, IDC_KEYSSH2DSA, MF_GRAYED|MF_BYCOMMAND);
|
EnableMenuItem(state->keymenu, IDC_KEYSSH2DSA, MF_GRAYED|MF_BYCOMMAND);
|
||||||
EnableMenuItem(state->exportmenu, IDC_EXPORT_OPENSSH,
|
EnableMenuItem(state->cvtmenu, IDC_IMPORT, MF_GRAYED|MF_BYCOMMAND);
|
||||||
|
EnableMenuItem(state->cvtmenu, IDC_EXPORT_OPENSSH,
|
||||||
MF_GRAYED|MF_BYCOMMAND);
|
MF_GRAYED|MF_BYCOMMAND);
|
||||||
EnableMenuItem(state->exportmenu, IDC_EXPORT_SSHCOM,
|
EnableMenuItem(state->cvtmenu, IDC_EXPORT_SSHCOM,
|
||||||
MF_GRAYED|MF_BYCOMMAND);
|
MF_GRAYED|MF_BYCOMMAND);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -587,13 +589,14 @@ void ui_set_state(HWND hwnd, struct MainDlgState *state, int status)
|
||||||
EnableMenuItem(state->keymenu, IDC_KEYSSH1, MF_ENABLED|MF_BYCOMMAND);
|
EnableMenuItem(state->keymenu, IDC_KEYSSH1, MF_ENABLED|MF_BYCOMMAND);
|
||||||
EnableMenuItem(state->keymenu, IDC_KEYSSH2RSA,MF_ENABLED|MF_BYCOMMAND);
|
EnableMenuItem(state->keymenu, IDC_KEYSSH2RSA,MF_ENABLED|MF_BYCOMMAND);
|
||||||
EnableMenuItem(state->keymenu, IDC_KEYSSH2DSA,MF_ENABLED|MF_BYCOMMAND);
|
EnableMenuItem(state->keymenu, IDC_KEYSSH2DSA,MF_ENABLED|MF_BYCOMMAND);
|
||||||
|
EnableMenuItem(state->cvtmenu, IDC_IMPORT, MF_ENABLED|MF_BYCOMMAND);
|
||||||
/*
|
/*
|
||||||
* Enable export menu items if and only if the key type
|
* Enable export menu items if and only if the key type
|
||||||
* supports this kind of export.
|
* supports this kind of export.
|
||||||
*/
|
*/
|
||||||
type = state->ssh2 ? SSH_KEYTYPE_SSH2 : SSH_KEYTYPE_SSH1;
|
type = state->ssh2 ? SSH_KEYTYPE_SSH2 : SSH_KEYTYPE_SSH1;
|
||||||
#define do_export_menuitem(x,y) \
|
#define do_export_menuitem(x,y) \
|
||||||
EnableMenuItem(state->exportmenu, x, MF_BYCOMMAND | \
|
EnableMenuItem(state->cvtmenu, x, MF_BYCOMMAND | \
|
||||||
(import_target_type(y)==type?MF_ENABLED:MF_GRAYED))
|
(import_target_type(y)==type?MF_ENABLED:MF_GRAYED))
|
||||||
do_export_menuitem(IDC_EXPORT_OPENSSH, SSH_KEYTYPE_OPENSSH);
|
do_export_menuitem(IDC_EXPORT_OPENSSH, SSH_KEYTYPE_OPENSSH);
|
||||||
do_export_menuitem(IDC_EXPORT_SSHCOM, SSH_KEYTYPE_SSHCOM);
|
do_export_menuitem(IDC_EXPORT_SSHCOM, SSH_KEYTYPE_SSHCOM);
|
||||||
|
@ -657,13 +660,15 @@ static int CALLBACK MainDlgProc(HWND hwnd, UINT msg,
|
||||||
state->keymenu = menu1;
|
state->keymenu = menu1;
|
||||||
|
|
||||||
menu1 = CreateMenu();
|
menu1 = CreateMenu();
|
||||||
|
AppendMenu(menu1, MF_ENABLED, IDC_IMPORT, "&Import key");
|
||||||
|
AppendMenu(menu1, MF_SEPARATOR, 0, 0);
|
||||||
AppendMenu(menu1, MF_ENABLED, IDC_EXPORT_OPENSSH,
|
AppendMenu(menu1, MF_ENABLED, IDC_EXPORT_OPENSSH,
|
||||||
"Export &OpenSSH key");
|
"Export &OpenSSH key");
|
||||||
AppendMenu(menu1, MF_ENABLED, IDC_EXPORT_SSHCOM,
|
AppendMenu(menu1, MF_ENABLED, IDC_EXPORT_SSHCOM,
|
||||||
"Export &ssh.com key");
|
"Export &ssh.com key");
|
||||||
AppendMenu(menu, MF_POPUP | MF_ENABLED, (UINT) menu1,
|
AppendMenu(menu, MF_POPUP | MF_ENABLED, (UINT) menu1,
|
||||||
"&Export");
|
"&Conversions");
|
||||||
state->exportmenu = menu1;
|
state->cvtmenu = menu1;
|
||||||
|
|
||||||
menu1 = CreateMenu();
|
menu1 = CreateMenu();
|
||||||
AppendMenu(menu1, MF_ENABLED, IDC_ABOUT, "&About");
|
AppendMenu(menu1, MF_ENABLED, IDC_ABOUT, "&About");
|
||||||
|
@ -1024,6 +1029,7 @@ static int CALLBACK MainDlgProc(HWND hwnd, UINT msg,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IDC_LOAD:
|
case IDC_LOAD:
|
||||||
|
case IDC_IMPORT:
|
||||||
state =
|
state =
|
||||||
(struct MainDlgState *) GetWindowLong(hwnd, GWL_USERDATA);
|
(struct MainDlgState *) GetWindowLong(hwnd, GWL_USERDATA);
|
||||||
if (!state->generation_thread_exists) {
|
if (!state->generation_thread_exists) {
|
||||||
|
@ -1174,6 +1180,24 @@ static int CALLBACK MainDlgProc(HWND hwnd, UINT msg,
|
||||||
*/
|
*/
|
||||||
ui_set_state(hwnd, state, 2);
|
ui_set_state(hwnd, state, 2);
|
||||||
state->key_exists = TRUE;
|
state->key_exists = TRUE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the user has imported a foreign key
|
||||||
|
* using the Load command, let them know.
|
||||||
|
* If they've used the Import command, be
|
||||||
|
* silent.
|
||||||
|
*/
|
||||||
|
if (realtype != type && LOWORD(wParam) == IDC_LOAD) {
|
||||||
|
char msg[512];
|
||||||
|
sprintf(msg, "Successfully imported foreign key\n"
|
||||||
|
"(%s).\n"
|
||||||
|
"To use this key with PuTTY, you need to\n"
|
||||||
|
"use the \"Save private key\" command to\n"
|
||||||
|
"save it in PuTTY's own format.",
|
||||||
|
key_type_to_str(realtype));
|
||||||
|
MessageBox(NULL, msg, "PuTTYgen Notice",
|
||||||
|
MB_OK | MB_ICONINFORMATION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1307,9 +1331,10 @@ static int CALLBACK MainDlgProc(HWND hwnd, UINT msg,
|
||||||
case IDC_BITSSTATIC:
|
case IDC_BITSSTATIC:
|
||||||
case IDC_BITS:
|
case IDC_BITS:
|
||||||
cmd = "JI(`',`puttygen.bits')"; break;
|
cmd = "JI(`',`puttygen.bits')"; break;
|
||||||
|
case IDC_IMPORT:
|
||||||
case IDC_EXPORT_OPENSSH:
|
case IDC_EXPORT_OPENSSH:
|
||||||
case IDC_EXPORT_SSHCOM:
|
case IDC_EXPORT_SSHCOM:
|
||||||
cmd = "JI(`',`puttygen.export')"; break;
|
cmd = "JI(`',`puttygen.conversions')"; break;
|
||||||
}
|
}
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
WinHelp(hwnd, help_path, HELP_COMMAND, (DWORD)cmd);
|
WinHelp(hwnd, help_path, HELP_COMMAND, (DWORD)cmd);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче