114 |
return NULL; |
return NULL; |
115 |
|
|
116 |
if( comment && *comment ) { |
if( comment && *comment ) { |
117 |
size = strlen( key_params_with_comment ) |
size = strlen (key_params_with_comment) |
118 |
+ 16 |
+ 16 |
119 |
+ strlen( user ) |
+ strlen( user ) |
120 |
+ addsize |
+ addsize |
316 |
} |
} |
317 |
} |
} |
318 |
free_if_alloc( path ); |
free_if_alloc( path ); |
319 |
} /* ask_for_backup */ |
} |
320 |
|
|
321 |
|
|
322 |
/* Fill in all valid GPG algorithms. */ |
/* Fill in all valid GPG algorithms. */ |
345 |
{ |
{ |
346 |
SYSTEMTIME t; |
SYSTEMTIME t; |
347 |
|
|
348 |
GetSystemTime( &t ); |
GetSystemTime (&t); |
349 |
if( st->wYear > t.wYear || st->wMonth > t.wMonth ) |
if (st->wYear > t.wYear || st->wMonth > t.wMonth) |
350 |
return 1; |
return 1; |
351 |
else if( st->wYear < t.wYear || st->wMonth < t.wMonth || st->wDay < t.wDay) |
else if (st->wYear < t.wYear || st->wMonth < t.wMonth || st->wDay < t.wDay) |
352 |
return 0; |
return 0; |
353 |
return 1; |
return 1; |
354 |
} /* keygen_check_date */ |
} |
355 |
|
|
356 |
|
|
357 |
/* Dialog box procedure for key generation. */ |
/* Dialog box procedure for key generation. */ |
383 |
SetDlgItemText( dlg, IDC_KEYGEN_NAMEINF, _("&Real name") ); |
SetDlgItemText( dlg, IDC_KEYGEN_NAMEINF, _("&Real name") ); |
384 |
SetDlgItemText( dlg, IDC_KEYGEN_COMMINF, _("&Comment (optional)") ); |
SetDlgItemText( dlg, IDC_KEYGEN_COMMINF, _("&Comment (optional)") ); |
385 |
SetDlgItemText( dlg, IDC_KEYGEN_EMAILINF, _("Email &address") ); |
SetDlgItemText( dlg, IDC_KEYGEN_EMAILINF, _("Email &address") ); |
386 |
SetDlgItemText( dlg, IDC_KEYGEN_EXPINF, _("Key &expiration") ); |
SetDlgItemText( dlg, IDC_KEYGEN_EXPINF, _("&Expire date")); |
387 |
SetDlgItemText( dlg, IDC_KEYGEN_PWDINF, _("&Passphrase") ); |
SetDlgItemText( dlg, IDC_KEYGEN_PWDINF, _("&Passphrase") ); |
388 |
SetDlgItemText( dlg, IDC_KEYGEN_REPWDINF, _("&Repeat passphrase") ); |
SetDlgItemText( dlg, IDC_KEYGEN_REPWDINF, _("&Repeat passphrase") ); |
389 |
SetDlgItemText( dlg, IDC_KEYGEN_KEYTYPEINF, _("Key &type") ); |
SetDlgItemText( dlg, IDC_KEYGEN_KEYTYPEINF, _("Key &type") ); |
390 |
SetDlgItemText (dlg, IDC_KEYGEN_CLEAR, _("&Never")); |
SetDlgItemText (dlg, IDC_KEYGEN_EXPNEVER, _("&Never")); |
391 |
SetDlgItemText (dlg, IDC_KEYGEN_HIDEPWD, _("&Hide Typing")); |
SetDlgItemText (dlg, IDC_KEYGEN_HIDEPWD, _("&Hide Typing")); |
392 |
#endif |
#endif |
393 |
SetDlgItemInt( dlg, IDC_KEYGEN_SUBKEYBITS, 2048, FALSE ); |
SetDlgItemInt( dlg, IDC_KEYGEN_SUBKEYBITS, 2048, FALSE ); |
493 |
if( strcmp( pwd, pwd2 ) ) { |
if( strcmp( pwd, pwd2 ) ) { |
494 |
msg_box( dlg, _("Passphrases are NOT identical!" ), |
msg_box( dlg, _("Passphrases are NOT identical!" ), |
495 |
_("Key Generation"), MB_ERR ); |
_("Key Generation"), MB_ERR ); |
496 |
memset( pwd, 0, sizeof pwd ); |
wipememory (pwd, sizeof (pwd)); |
497 |
memset( pwd2, 0, sizeof pwd2 ); |
wipememory (pwd2, sizeof (pwd2)); |
498 |
return FALSE; |
return FALSE; |
499 |
} |
} |
500 |
if( is_8bit_string( pwd ) ) { |
if( is_8bit_string( pwd ) ) { |
501 |
msg_box( dlg, _("The passphrase contains 8-bit characters.\n" |
msg_box( dlg, _("The passphrase contains 8-bit characters.\n" |
502 |
"It is not suggested to use charset specific characters."), |
"It is not suggested to use charset specific characters."), |
503 |
_("Key Generation"), MB_ERR ); |
_("Key Generation"), MB_ERR ); |
504 |
memset( pwd, 0, sizeof pwd ); |
wipememory (pwd, sizeof (pwd)); |
505 |
memset( pwd2, 0, sizeof pwd2 ); |
wipememory (pwd2, sizeof (pwd2)); |
506 |
SetDlgItemText( dlg, IDC_KEYGEN_PASSPHRASE, "" ); |
SetDlgItemText( dlg, IDC_KEYGEN_PASSPHRASE, "" ); |
507 |
SetDlgItemText( dlg, IDC_KEYGEN_PWDCHECK, "" ); |
SetDlgItemText( dlg, IDC_KEYGEN_PWDCHECK, "" ); |
508 |
return FALSE; |
return FALSE; |
528 |
} |
} |
529 |
keygen_cb_dlg_create( ); |
keygen_cb_dlg_create( ); |
530 |
err = gpg_genkey (p, keygen_cb, &fpr); |
err = gpg_genkey (p, keygen_cb, &fpr); |
531 |
memset( pwd, 0, sizeof pwd ); |
wipememory (pwd, sizeof (pwd)); |
532 |
memset( pwd2, 0, sizeof pwd2 ); |
wipememory (pwd2, sizeof (pwd2)); |
533 |
if( p ) { |
if( p ) { |
534 |
memset( p, 0, strlen( p ) ); /* burn the passphrase! */ |
wipememory (p, strlen (p)); /* burn the passphrase! */ |
535 |
free( p ); |
free (p); |
536 |
} |
} |
537 |
keygen_cb_dlg_destroy( ); |
keygen_cb_dlg_destroy (); |
538 |
keygen_cb( NULL, NULL, 0, 0, 0 ); /* flush */ |
keygen_cb (NULL, NULL, 0, 0, 0); /* flush */ |
539 |
if( err ) { |
if( err ) { |
540 |
if (fpr) |
if (fpr) |
541 |
free (fpr); |
free (fpr); |
566 |
} |
} |
567 |
|
|
568 |
return FALSE; |
return FALSE; |
569 |
} /* keygen_dlg_proc */ |
} |
570 |
|
|
571 |
|
|
572 |
BOOL CALLBACK |
BOOL CALLBACK |
592 |
SetDlgItemText (dlg, IDC_KEYWIZARD_TITLEINF, _("Name and E-Mail Assignment")); |
SetDlgItemText (dlg, IDC_KEYWIZARD_TITLEINF, _("Name and E-Mail Assignment")); |
593 |
SetDlgItemText (dlg, IDC_KEYWIZARD_TEXT1INF, _("Every key pair must have a name associated with it. The name and\nemail address let your correspondents that your public key they are\nusing belongs to us.")); |
SetDlgItemText (dlg, IDC_KEYWIZARD_TEXT1INF, _("Every key pair must have a name associated with it. The name and\nemail address let your correspondents that your public key they are\nusing belongs to us.")); |
594 |
SetDlgItemText (dlg, IDC_KEYWIZARD_TEXT2INF, _("By accosiating an email address with your key pair, you will enable WinPT to assist your correspondents in selecting the correct public\nkey when communicating with you.")); |
SetDlgItemText (dlg, IDC_KEYWIZARD_TEXT2INF, _("By accosiating an email address with your key pair, you will enable WinPT to assist your correspondents in selecting the correct public\nkey when communicating with you.")); |
595 |
|
SetWindowText (dlg, _("Key Generation Wizard")); |
596 |
SetForegroundWindow (dlg); |
SetForegroundWindow (dlg); |
597 |
center_window (dlg, NULL); |
center_window (dlg, NULL); |
598 |
break; |
break; |