X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=puttygen.c;h=6642ab2b0c285c82dce42ad1e1b87b6857eb5761;hb=07d48d8b27f833e26bb75c3973e69975e23a9f9c;hp=330176c6655817136f4d86c345a0d8c5ec355aaf;hpb=f9cbbc3387d73456fdcebdbc0d98d7c4a8da472e;p=PuTTY.git diff --git a/puttygen.c b/puttygen.c index 330176c6..6642ab2b 100644 --- a/puttygen.c +++ b/puttygen.c @@ -846,22 +846,25 @@ static int CALLBACK MainDlgProc(HWND hwnd, UINT msg, if (prompt_keyfile(hwnd, "Load private key:", filename, 0)) { char passphrase[PASSPHRASE_MAXLEN]; int needs_pass; - int ver; + int type; int ret; char *comment; struct PassphraseProcStruct pps; struct RSAKey newkey1; struct ssh2_userkey *newkey2 = NULL; - ver = keyfile_version(filename); - if (ver == 0) { - MessageBox(NULL, "Couldn't load private key.", + type = key_type(filename); + if (type != SSH_KEYTYPE_SSH1 && type != SSH_KEYTYPE_SSH2) { + char msg[256]; + sprintf(msg, "Couldn't load private key (%s)", + key_type_to_str(type)); + MessageBox(NULL, msg, "PuTTYgen Error", MB_OK | MB_ICONERROR); break; } comment = NULL; - if (ver == 1) + if (type == SSH_KEYTYPE_SSH1) needs_pass = rsakey_encrypted(filename, &comment); else needs_pass = @@ -881,7 +884,7 @@ static int CALLBACK MainDlgProc(HWND hwnd, UINT msg, } } else *passphrase = '\0'; - if (ver == 1) + if (type == SSH_KEYTYPE_SSH1) ret = loadrsakey(filename, &newkey1, passphrase); else { @@ -918,7 +921,7 @@ static int CALLBACK MainDlgProc(HWND hwnd, UINT msg, passphrase); SetDlgItemText(hwnd, IDC_PASSPHRASE2EDIT, passphrase); - if (ver == 1) { + if (type == SSH_KEYTYPE_SSH1) { char buf[128]; char *savecomment; @@ -1142,6 +1145,8 @@ static int CALLBACK MainDlgProc(HWND hwnd, UINT msg, return 0; } +void cleanup_exit(int code) { exit(code); } + int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { InitCommonControls();