46 |
static const char key_params[] = |
static const char key_params[] = |
47 |
"<GnupgKeyParms format=\"internal\">\n" |
"<GnupgKeyParms format=\"internal\">\n" |
48 |
"Key-Type: %s\n" |
"Key-Type: %s\n" |
49 |
|
"Key-Usage: sign\n" |
50 |
"Key-Length: %d\n" |
"Key-Length: %d\n" |
51 |
"Subkey-Type: %s\n" |
"Subkey-Type: %s\n" |
52 |
"Subkey-Length: %d\n" |
"Subkey-Length: %d\n" |
59 |
static const char key_params_with_comment[] = |
static const char key_params_with_comment[] = |
60 |
"<GnupgKeyParms format=\"internal\">\n" |
"<GnupgKeyParms format=\"internal\">\n" |
61 |
"Key-Type: %s\n" |
"Key-Type: %s\n" |
62 |
|
"Key-Usage: sign\n" |
63 |
"Key-Length: %d\n" |
"Key-Length: %d\n" |
64 |
"Subkey-Type: %s\n" |
"Subkey-Type: %s\n" |
65 |
"Subkey-Length: %d\n" |
"Subkey-Length: %d\n" |
141 |
if( comment && *comment ) { |
if( comment && *comment ) { |
142 |
switch( keytype ) { |
switch( keytype ) { |
143 |
case GPG_KEYGEN_DSA_ELG: |
case GPG_KEYGEN_DSA_ELG: |
144 |
sprintf( p, key_params_with_comment, |
sprintf (p, key_params_with_comment, |
145 |
"DSA", 1024, "ELG-E", bits, user, comment, email, |
"DSA", 1024, "ELG-E", bits, user, comment, email, |
146 |
expdate ? expdate : "0", passphrase ); |
expdate ? expdate : "0", passphrase); |
147 |
break; |
break; |
148 |
|
|
149 |
case GPG_KEYGEN_DSA_RSA: |
case GPG_KEYGEN_DSA_RSA: |
361 |
keygen_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
keygen_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
362 |
{ |
{ |
363 |
static genkey_s *ctx; |
static genkey_s *ctx; |
|
static int hide = 1; |
|
|
static int act_expdate = 0; |
|
364 |
SYSTEMTIME st; |
SYSTEMTIME st; |
365 |
gpgme_error_t err; |
gpgme_error_t err; |
366 |
char name[128] = {0}, email[128] = {0}, comment[128] = {0}; |
char name[128] = {0}, email[128] = {0}, comment[128] = {0}; |
373 |
case WM_INITDIALOG: |
case WM_INITDIALOG: |
374 |
if (lparam != NULL) |
if (lparam != NULL) |
375 |
ctx = (genkey_s *)lparam; |
ctx = (genkey_s *)lparam; |
|
hide = 1; |
|
|
#ifndef LANG_DE |
|
376 |
SetWindowText( dlg, _("Key Generation") ); |
SetWindowText( dlg, _("Key Generation") ); |
377 |
SetDlgItemText( dlg, IDC_KEYGEN_INFO, |
SetDlgItemText( dlg, IDC_KEYGEN_INFO, |
378 |
_("NOTE: Key generation can be a lengthy process! Please wait until " |
_("NOTE: Key generation can be a lengthy process! Please wait until " |
387 |
SetDlgItemText( dlg, IDC_KEYGEN_KEYTYPEINF, _("Key &type") ); |
SetDlgItemText( dlg, IDC_KEYGEN_KEYTYPEINF, _("Key &type") ); |
388 |
SetDlgItemText (dlg, IDC_KEYGEN_EXPNEVER, _("&Never")); |
SetDlgItemText (dlg, IDC_KEYGEN_EXPNEVER, _("&Never")); |
389 |
SetDlgItemText (dlg, IDC_KEYGEN_HIDEPWD, _("&Hide Typing")); |
SetDlgItemText (dlg, IDC_KEYGEN_HIDEPWD, _("&Hide Typing")); |
390 |
#endif |
|
391 |
SetDlgItemInt( dlg, IDC_KEYGEN_SUBKEYBITS, 2048, FALSE ); |
SetDlgItemInt (dlg, IDC_KEYGEN_SUBKEYBITS, 2048, FALSE); |
392 |
CheckDlgButton (dlg, IDC_KEYGEN_HIDEPWD, BST_CHECKED); |
CheckDlgButton (dlg, IDC_KEYGEN_HIDEPWD, BST_CHECKED); |
393 |
CheckDlgButton (dlg, IDC_KEYGEN_EXPNEVER, BST_CHECKED); |
CheckDlgButton (dlg, IDC_KEYGEN_EXPNEVER, BST_CHECKED); |
394 |
EnableWindow (GetDlgItem (dlg, IDC_KEYGEN_EXPDATE), FALSE); |
EnableWindow (GetDlgItem (dlg, IDC_KEYGEN_EXPDATE), FALSE); |
395 |
fill_keytype_box( dlg ); |
fill_keytype_box (dlg); |
396 |
center_window( dlg, NULL ); |
center_window (dlg, NULL); |
397 |
SetForegroundWindow( dlg ); |
SetForegroundWindow (dlg); |
398 |
return TRUE; |
return TRUE; |
399 |
|
|
400 |
case WM_SYSCOMMAND: |
case WM_SYSCOMMAND: |
401 |
if( LOWORD( wparam ) == SC_CLOSE ) { |
if (LOWORD (wparam) == SC_CLOSE) { |
402 |
SetDlgItemText( dlg, IDC_KEYGEN_PASSPHRASE, "" ); |
SetDlgItemText (dlg, IDC_KEYGEN_PASSPHRASE, ""); |
403 |
SetDlgItemText( dlg, IDC_KEYGEN_PWDCHECK, "" ); |
SetDlgItemText (dlg, IDC_KEYGEN_PWDCHECK, ""); |
404 |
EndDialog( dlg, TRUE ); |
EndDialog (dlg, TRUE); |
405 |
} |
} |
406 |
return FALSE; |
return FALSE; |
407 |
|
|
408 |
case WM_COMMAND: |
case WM_COMMAND: |
409 |
if (HIWORD (wparam) == BN_CLICKED && |
if (HIWORD (wparam) == BN_CLICKED && |
410 |
LOWORD (wparam) == IDC_KEYGEN_EXPNEVER) { |
LOWORD (wparam) == IDC_KEYGEN_EXPNEVER) { |
411 |
act_expdate ^= 1; |
int never = IsDlgButtonChecked (dlg, IDC_KEYGEN_EXPNEVER); |
412 |
EnableWindow (GetDlgItem (dlg, IDC_KEYGEN_EXPDATE), act_expdate); |
EnableWindow (GetDlgItem (dlg, IDC_KEYGEN_EXPDATE), !never); |
413 |
} |
} |
414 |
if( HIWORD( wparam ) == BN_CLICKED |
if (HIWORD (wparam) == BN_CLICKED |
415 |
&& LOWORD( wparam ) == IDC_KEYGEN_HIDEPWD ) { |
&& LOWORD (wparam) == IDC_KEYGEN_HIDEPWD) { |
416 |
HWND hwnd_a = GetDlgItem( dlg, IDC_KEYGEN_PASSPHRASE ); |
HWND hwnd_a = GetDlgItem (dlg, IDC_KEYGEN_PASSPHRASE); |
417 |
HWND hwnd_b = GetDlgItem( dlg, IDC_KEYGEN_PWDCHECK ); |
HWND hwnd_b = GetDlgItem (dlg, IDC_KEYGEN_PWDCHECK); |
418 |
hide ^= 1; |
int hide = IsDlgButtonChecked (dlg, IDC_KEYGEN_HIDEPWD); |
419 |
SendMessage( hwnd_a, EM_SETPASSWORDCHAR, hide? '*' : 0, 0 ); |
SendMessage (hwnd_a, EM_SETPASSWORDCHAR, hide? '*' : 0, 0); |
420 |
SetFocus( hwnd_a ); |
SetFocus (hwnd_a); |
421 |
SendMessage( hwnd_b, EM_SETPASSWORDCHAR, hide? '*' : 0, 0 ); |
SendMessage (hwnd_b, EM_SETPASSWORDCHAR, hide? '*' : 0, 0); |
422 |
SetFocus( hwnd_b ); |
SetFocus (hwnd_b); |
|
|
|
423 |
} |
} |
424 |
|
|
425 |
switch( LOWORD( wparam ) ) { |
switch( LOWORD( wparam ) ) { |