1 |
/* wptCardDlg.cpp - Smart Card support |
/* wptCardDlg.cpp - Smart Card support |
2 |
* Copyright (C) 2003, 2004, 2005 Timo Schulz |
* Copyright (C) 2003-2006 Timo Schulz |
3 |
* Copyright (C) 2005 g10 Code GmbH |
* Copyright (C) 2005 g10 Code GmbH |
4 |
* |
* |
5 |
* This file is part of WinPT. |
* This file is part of WinPT. |
44 |
|
|
45 |
int keygen_check_date (SYSTEMTIME * st); |
int keygen_check_date (SYSTEMTIME * st); |
46 |
|
|
47 |
static const char * sex[] = {"Male", "Female", "Undefined", NULL}; |
|
48 |
static const char * lang[] = {"Undefined", "cs", "de", "en", "es", "fr", "hu", |
#define OPENPGP_APPID "D276000124" |
49 |
|
|
50 |
|
/* Possible values for the sex field. */ |
51 |
|
static const char *sex[] = {"Male", "Female", "Undefined", NULL}; |
52 |
|
|
53 |
|
/* Predefined languages. */ |
54 |
|
static const char *lang[] = {"Undefined", "cs", "de", "en", "es", "fr", "hu", |
55 |
"it", "nl", "pt", "ro", "ru", "zh", "at", |
"it", "nl", "pt", "ro", "ru", "zh", "at", |
56 |
NULL}; |
NULL}; |
57 |
|
|
58 |
|
/* PIN callback context. */ |
59 |
static pin_cb_ctx_s pincb; |
static pin_cb_ctx_s pincb; |
60 |
|
|
61 |
|
/* Attribute table. */ |
62 |
struct { |
struct { |
63 |
int ctlid; |
int ctlid; |
64 |
const char * err; |
const char *err; |
65 |
} attr_tab[] = { |
} attr_tab[] = { |
66 |
{IDC_CEDIT_AID, ""}, |
{IDC_CEDIT_AID, ""}, |
67 |
{IDC_CEDIT_VENDOR, "No Vendor"}, |
{IDC_CEDIT_VENDOR, "No Vendor"}, |
76 |
|
|
77 |
|
|
78 |
|
|
|
/* XXX: simplify code. */ |
|
|
char* |
|
|
get_printable_version (const char *version) |
|
|
{ |
|
|
static char buf[16]; |
|
|
char tmp_maj[3]={0}, tmp_min[3]={0}; |
|
|
|
|
|
strncpy (tmp_maj, version, 2); |
|
|
strncpy (tmp_min, version+2, 2); |
|
|
sprintf (buf, "%d.%d", atoi (tmp_maj), atoi (tmp_min)); |
|
|
return buf; |
|
|
} |
|
|
|
|
79 |
/* Return all card attributes from @card. @n contains |
/* Return all card attributes from @card. @n contains |
80 |
the number of items which were returned. */ |
the number of items which were returned. */ |
81 |
char** |
char** |
82 |
card_get_items (gpg_card_t card, int *n) |
card_get_items (gpg_card_t card, int *n) |
83 |
{ |
{ |
84 |
|
static char printver[16]; |
85 |
char **p; |
char **p; |
86 |
|
|
87 |
*n= 8; |
*n= 8; |
88 |
p = (char **)calloc (*n+1, sizeof (char*)); |
p = (char **)calloc (*n+1, sizeof (char*)); |
89 |
if (!p) |
if (!p) |
90 |
BUG (0); |
BUG (0); |
91 |
|
_snprintf (printver, sizeof (printver)-1, "%d.%d", |
92 |
|
card->ver[0], card->ver[1]); |
93 |
p[0] = card->aid; |
p[0] = card->aid; |
94 |
p[1] = card->vendor; |
p[1] = card->vendor; |
95 |
p[2] = get_printable_version (card->version); |
p[2] = printver; |
96 |
p[3] = card->serial; |
p[3] = card->serial; |
97 |
p[4] = card->givenname; |
p[4] = card->givenname; |
98 |
p[5] = card->surname; |
p[5] = card->surname; |
103 |
|
|
104 |
|
|
105 |
static int |
static int |
106 |
idx_from_lang (const char * _lang) |
idx_from_lang (const char *_lang) |
107 |
{ |
{ |
108 |
const char * s; |
const char *s; |
109 |
int i; |
int i; |
110 |
|
|
111 |
if (!_lang) |
if (!_lang) |
112 |
return 0; |
return 0; |
113 |
for (i=0; (s = lang[i]); i++) { |
for (i=0; (s = lang[i]); i++) { |
114 |
if (!strcmp (_lang, s )) |
if (!strcmp (_lang, s)) |
115 |
return i; |
return i; |
116 |
} |
} |
117 |
return 0; |
return 0; |
118 |
} |
} |
119 |
|
|
120 |
|
|
121 |
|
static GpgCardEdit* |
122 |
|
create_GpgCardEdit (void) |
123 |
|
{ |
124 |
|
GpgCardEdit *ce; |
125 |
|
|
126 |
|
ce = new GpgCardEdit (); |
127 |
|
if (!ce) |
128 |
|
BUG (0); |
129 |
|
return ce; |
130 |
|
} |
131 |
|
|
132 |
|
|
133 |
/* Check if there is a card in the reader and analyze the |
/* Check if there is a card in the reader and analyze the |
134 |
returned information. |
returned information. |
135 |
Return value: card context or NULL on error. */ |
Return value: card context or NULL on error. */ |
141 |
gpg_card_t card = NULL; |
gpg_card_t card = NULL; |
142 |
struct card_cb_s cb = {0}; |
struct card_cb_s cb = {0}; |
143 |
|
|
144 |
ce = new GpgCardEdit (); |
ce = create_GpgCardEdit (); |
|
if (!ce) |
|
|
BUG (0); |
|
145 |
memset (&cb, 0, sizeof (cb)); |
memset (&cb, 0, sizeof (cb)); |
146 |
ce->setCallback (card_callback, &cb); |
ce->setCallback (card_callback, &cb); |
147 |
err = ce->getCardStatus (&card); |
err = ce->getCardStatus (&card); |
150 |
goto leave; |
goto leave; |
151 |
} |
} |
152 |
|
|
153 |
if (!card->aid || strncmp (card->aid, "D276000124", 10)) { |
if (!card->aid || |
154 |
|
strncmp (card->aid, OPENPGP_APPID, strlen (OPENPGP_APPID))) { |
155 |
msg_box (NULL, winpt_strerror (WPTERR_NOPGPCARD), "WinPT", MB_ERR); |
msg_box (NULL, winpt_strerror (WPTERR_NOPGPCARD), "WinPT", MB_ERR); |
156 |
gpg_card_release (card); |
gpg_card_release (card); |
157 |
card = NULL; |
card = NULL; |
158 |
} |
} |
159 |
else { |
else { |
160 |
struct winpt_key_s key; |
struct winpt_key_s key; |
161 |
|
|
162 |
memset (&key, 0, sizeof (key)); |
memset (&key, 0, sizeof (key)); |
163 |
winpt_get_pubkey (card->fpr[1]+32, &key); |
winpt_get_pubkey (card->fpr[1]+32, &key); |
164 |
if (key.ext) { |
if (key.ext) { |
165 |
key.ext->card_type = m_strdup (card->card_type); |
key.ext->card_type = m_strdup (card->card_type); |
|
if (!key.ext->card_type) |
|
|
BUG (NULL); |
|
166 |
/* memory will be released in gpg_keycache_release (). */ |
/* memory will be released in gpg_keycache_release (). */ |
167 |
} |
} |
168 |
} |
} |
185 |
strcpy (buf, _("No Fingerprint")); |
strcpy (buf, _("No Fingerprint")); |
186 |
else { |
else { |
187 |
memset (buf, 0, sizeof (buf)); |
memset (buf, 0, sizeof (buf)); |
188 |
for( i=0, c=0; i < strlen (fpr); i++) { |
for (i=0, c=0; i < strlen (fpr); i++) { |
189 |
dig[0] = fpr[i]; dig[1] = 0; |
dig[0] = fpr[i]; dig[1] = 0; |
190 |
strcat (buf, dig); |
strcat (buf, dig); |
191 |
if (++c == 4) { |
if (++c == 4) { |
205 |
card_status (HWND dlg, gpg_card_t card) |
card_status (HWND dlg, gpg_card_t card) |
206 |
{ |
{ |
207 |
static int fprbuf[] = {IDC_CEDIT_FPR1, IDC_CEDIT_FPR2, IDC_CEDIT_FPR3, 0}; |
static int fprbuf[] = {IDC_CEDIT_FPR1, IDC_CEDIT_FPR2, IDC_CEDIT_FPR3, 0}; |
208 |
static int fprtime[] = {IDC_CEDIT_SIG_FPRTIME, IDC_CEDIT_DEC_FPRTIME, IDC_CEDIT_AUTH_FPRTIME, 0}; |
static int fprtime[] = {IDC_CEDIT_SIG_FPRTIME, IDC_CEDIT_DEC_FPRTIME, |
209 |
|
IDC_CEDIT_AUTH_FPRTIME, 0}; |
210 |
const char *s; |
const char *s; |
211 |
char **attrs; |
char **attrs; |
212 |
char cardinf[128]; |
char cardinf[128]; |
213 |
int idx=0, n=0; |
int idx=0, n=0; |
214 |
|
|
215 |
if (!card->aid) { |
if (!card->aid) { |
216 |
msg_box( dlg, _("No OpenPGP smart card detected."), "WinPT", MB_ERR ); |
msg_box (dlg, _("No OpenPGP smart card detected."), "WinPT", MB_ERR); |
217 |
return -1; |
return -1; |
218 |
} |
} |
219 |
SetDlgItemText (dlg, IDC_CEDIT_AID, card->aid); |
SetDlgItemText (dlg, IDC_CEDIT_AID, card->aid); |
221 |
|
|
222 |
for (idx=0; fprbuf[idx]; idx++) { |
for (idx=0; fprbuf[idx]; idx++) { |
223 |
print_fpr (dlg, fprbuf[idx], card->fpr[idx]); |
print_fpr (dlg, fprbuf[idx], card->fpr[idx]); |
224 |
SetDlgItemText (dlg, fprtime[idx], card->fpr_created_str[idx]); |
s = card->fpr_created_str[idx]; |
225 |
|
if (!s) /* no keys on the card. */ |
226 |
|
s = ""; |
227 |
|
SetDlgItemText (dlg, fprtime[idx], s); |
228 |
} |
} |
229 |
|
|
230 |
attrs = card_get_items (card, &n); |
attrs = card_get_items (card, &n); |
231 |
for (idx=1; attr_tab[idx].ctlid; idx++) { |
for (idx=1; attr_tab[idx].ctlid; idx++) { |
232 |
s = attrs[idx]; |
s = attrs[idx]; |
233 |
SetDlgItemText (dlg, attr_tab[idx].ctlid, s && *s? s : attr_tab[idx].err); |
SetDlgItemText (dlg, attr_tab[idx].ctlid, |
234 |
|
s && *s? s : attr_tab[idx].err); |
235 |
} |
} |
236 |
free (attrs); |
safe_free (attrs); |
237 |
|
|
238 |
idx = idx_from_lang (card->lang); |
idx = idx_from_lang (card->lang); |
239 |
SendDlgItemMessage (dlg, IDC_CEDIT_LANG, CB_SETCURSEL, (WPARAM)idx, 0); |
SendDlgItemMessage (dlg, IDC_CEDIT_LANG, CB_SETCURSEL, (WPARAM)idx, 0); |
248 |
|
|
249 |
s = card->serial; |
s = card->serial; |
250 |
while (s && *s == '0') s++; |
while (s && *s == '0') s++; |
251 |
_snprintf (cardinf, sizeof (cardinf)-1, |
_snprintf (cardinf, sizeof (cardinf)-1, |
252 |
"Card Edit - %s serial no. %s version %s", |
"Card Edit - %s serial no. %s version %d.%d", |
253 |
card->card_type, s, get_printable_version (card->version)); |
card->card_type, s, card->ver[0], card->ver[1]); |
254 |
SetWindowText (dlg, cardinf); |
SetWindowText (dlg, cardinf); |
255 |
|
|
256 |
return 0; |
return 0; |
278 |
check_string (const char *str, int flags) |
check_string (const char *str, int flags) |
279 |
{ |
{ |
280 |
size_t i; |
size_t i; |
281 |
|
|
282 |
for (i=0; i < strlen (str); i++) { |
for (i=0; i < strlen (str); i++) { |
283 |
if (flags & 0x02 && !isalpha (str[i])) |
if (flags & 0x02 && !isalpha (str[i])) |
284 |
return -1; |
return -1; |
341 |
return 0; |
return 0; |
342 |
} |
} |
343 |
|
|
344 |
ce = new GpgCardEdit (); |
ce = create_GpgCardEdit (); |
|
if (!ce) |
|
|
BUG (NULL); |
|
345 |
ce->setAdminPIN (cb->apin); |
ce->setAdminPIN (cb->apin); |
|
/*ce->setPIN (cb->upin);*/ |
|
346 |
for( i=0; idctl[i].id; i++ ) { |
for( i=0; idctl[i].id; i++ ) { |
347 |
if( idctl[i].changed ) { |
if( idctl[i].changed ) { |
348 |
GetDlgItemText( dlg, idctl[i].id, buf, sizeof (buf)-1 ); |
GetDlgItemText( dlg, idctl[i].id, buf, sizeof (buf)-1 ); |
391 |
} |
} |
392 |
delete ce; |
delete ce; |
393 |
return errc; |
return errc; |
394 |
} /* do_proc_card_cmds */ |
} |
395 |
|
|
396 |
|
|
397 |
/* Cleanup pin callback @ctx. */ |
/* Cleanup pin callback @ctx. */ |
415 |
do_askpin (HWND dlg, int which, gpg_card_t card, |
do_askpin (HWND dlg, int which, gpg_card_t card, |
416 |
struct pin_cb_ctx_s *cb) |
struct pin_cb_ctx_s *cb) |
417 |
{ |
{ |
418 |
const char * s, * fmt; |
const char *s, *fmt; |
419 |
const char * n1, * n2, * serial; |
const char *n1, *n2, *serial; |
420 |
char * p; |
char *p; |
421 |
size_t n; |
size_t n; |
422 |
|
|
423 |
if( (which == CARD_ADMIN_PIN && cb->apin) || |
if( (which == CARD_ADMIN_PIN && cb->apin) || |
443 |
if (!serial) |
if (!serial) |
444 |
serial = "No Serial ID"; |
serial = "No Serial ID"; |
445 |
n = strlen( n1 ) + strlen( n2 ) + strlen( fmt ) + strlen( serial ) + 3; |
n = strlen( n1 ) + strlen( n2 ) + strlen( fmt ) + strlen( serial ) + 3; |
446 |
p = cb->info_text = new char[strlen( s )+n+1 ]; |
p = cb->info_text = new char[strlen (s)+n+1]; |
447 |
if( !p ) |
if( !p ) |
448 |
BUG (0); |
BUG (0); |
449 |
sprintf( p, fmt, s, n1, n2, serial ); |
sprintf (p, fmt, s, n1, n2, serial); |
450 |
} |
} |
451 |
else { |
else |
452 |
p = cb->info_text = m_strdup (s); |
p = cb->info_text = m_strdup (s); |
|
if (!p) |
|
|
BUG (0); |
|
|
} |
|
453 |
DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_PIN, dlg, |
DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_PIN, dlg, |
454 |
pin_cb_dlg_proc, (LPARAM)cb); |
pin_cb_dlg_proc, (LPARAM)cb); |
455 |
if (!cb->apin && !cb->upin) { |
if (!cb->apin && !cb->upin) { |
476 |
prepare_dialog (dlg); |
prepare_dialog (dlg); |
477 |
if (card_status (dlg, card )) |
if (card_status (dlg, card )) |
478 |
EndDialog (dlg, TRUE); |
EndDialog (dlg, TRUE); |
479 |
|
SetDlgItemText (dlg, IDC_CEDIT_NAMEINF, _("&Name")); |
480 |
|
SetDlgItemText (dlg, IDC_CEDIT_LANGINF, _("&Language")); |
481 |
|
SetDlgItemText (dlg, IDC_CEDIT_KURLINF, _("&Key-URL")); |
482 |
|
SetDlgItemText (dlg, IDC_CEDIT_LOGINF, _("&Login")); |
483 |
|
SetDlgItemText (dlg, IDC_CEDIT_SEXINF, _("&Sex")); |
484 |
|
SetDlgItemText (dlg, IDOK, _("&OK")); |
485 |
|
SetDlgItemText (dlg, IDCANCEL, _("&Exit")); |
486 |
|
SetDlgItemText (dlg, IDC_CEDIT_NEWKEYS, _("&New keys")); |
487 |
|
SetDlgItemText (dlg, IDC_CEDIT_CHPIN, _("Change &PIN")); |
488 |
center_window (dlg, NULL); |
center_window (dlg, NULL); |
489 |
SetForegroundWindow (dlg); |
SetForegroundWindow (dlg); |
490 |
return TRUE; |
return TRUE; |
495 |
break; |
break; |
496 |
|
|
497 |
case WM_COMMAND: |
case WM_COMMAND: |
498 |
switch( HIWORD( wparam ) ) { |
switch (HIWORD (wparam)) { |
499 |
case CBN_KILLFOCUS: |
case CBN_KILLFOCUS: |
500 |
case CBN_EDITCHANGE: |
case CBN_EDITCHANGE: |
501 |
case CBN_EDITUPDATE: |
case CBN_EDITUPDATE: |
502 |
int ctlid = GetDlgCtrlID( (HWND)lparam ); |
int ctlid = GetDlgCtrlID ((HWND)lparam); |
503 |
int dstid = 0; |
int dstid = 0; |
504 |
|
|
505 |
switch (ctlid) { |
switch (ctlid) { |
541 |
break; |
break; |
542 |
|
|
543 |
case IDCANCEL: |
case IDCANCEL: |
544 |
EndDialog( dlg, FALSE ); |
EndDialog (dlg, FALSE); |
545 |
break; |
break; |
546 |
} |
} |
547 |
break; |
break; |
584 |
|
|
585 |
switch (msg) { |
switch (msg) { |
586 |
case WM_INITDIALOG: |
case WM_INITDIALOG: |
|
center_window (dlg, NULL); |
|
587 |
CheckDlgButton (dlg, IDC_CKEYGEN_REPLACE, BST_CHECKED); |
CheckDlgButton (dlg, IDC_CKEYGEN_REPLACE, BST_CHECKED); |
588 |
CheckDlgButton (dlg, IDC_CKEYGEN_NEVER, BST_CHECKED); |
CheckDlgButton (dlg, IDC_CKEYGEN_NEVER, BST_CHECKED); |
589 |
CheckDlgButton (dlg, IDC_CKEYGEN_BACKUP, BST_CHECKED); |
CheckDlgButton (dlg, IDC_CKEYGEN_BACKUP, BST_CHECKED); |
591 |
SendDlgItemMessage (dlg, IDC_CKEYGEN_ALG, CB_ADDSTRING, 0, |
SendDlgItemMessage (dlg, IDC_CKEYGEN_ALG, CB_ADDSTRING, 0, |
592 |
(LPARAM)(const char*)"RSA"); |
(LPARAM)(const char*)"RSA"); |
593 |
SendDlgItemMessage (dlg, IDC_CKEYGEN_ALG, CB_SETCURSEL, 0, 0); |
SendDlgItemMessage (dlg, IDC_CKEYGEN_ALG, CB_SETCURSEL, 0, 0); |
594 |
SetFocus (GetDlgItem (dlg, IDC_CKEYGEN_NAME)); |
SetDlgItemText (dlg, IDC_CKEYGEN_PKINF, _("Pubkey algorithm")); |
|
SetForegroundWindow (dlg); |
|
595 |
SetDlgItemText (dlg, IDC_CKEYGEN_NAMEINF, _("&Name")); |
SetDlgItemText (dlg, IDC_CKEYGEN_NAMEINF, _("&Name")); |
596 |
SetDlgItemText (dlg, IDC_CKEYGEN_CMTINF, _("&Comment (optional)")); |
SetDlgItemText (dlg, IDC_CKEYGEN_CMTINF, _("&Comment (optional)")); |
597 |
SetDlgItemText (dlg, IDC_CKEYGEN_EXPDATEINF, _("&Expire date")); |
SetDlgItemText (dlg, IDC_CKEYGEN_EXPDATEINF, _("&Expire date")); |
601 |
SetDlgItemText (dlg, IDC_CKEYGEN_REPLACE, _("Overwrite old keys on the card")); |
SetDlgItemText (dlg, IDC_CKEYGEN_REPLACE, _("Overwrite old keys on the card")); |
602 |
SetDlgItemText (dlg, IDC_CKEYGEN_BACKUP, _("Make off-card backup of encryption key")); |
SetDlgItemText (dlg, IDC_CKEYGEN_BACKUP, _("Make off-card backup of encryption key")); |
603 |
SetWindowText (dlg, _("Card Key Generation")); |
SetWindowText (dlg, _("Card Key Generation")); |
604 |
return FALSE; |
center_window (dlg, NULL); |
605 |
|
SetForegroundWindow (dlg); |
606 |
case WM_SYSCOMMAND: |
SetFocus (GetDlgItem (dlg, IDC_CKEYGEN_NAME)); |
|
if (LOWORD (wparam) == SC_CLOSE) |
|
|
EndDialog (dlg, TRUE); |
|
607 |
return FALSE; |
return FALSE; |
608 |
|
|
609 |
case WM_COMMAND: |
case WM_COMMAND: |
637 |
} |
} |
638 |
GetDlgItemText (dlg, IDC_CKEYGEN_NAME, name, sizeof (name)-1); |
GetDlgItemText (dlg, IDC_CKEYGEN_NAME, name, sizeof (name)-1); |
639 |
GetDlgItemText (dlg, IDC_CKEYGEN_EMAIL, email, sizeof (email)-1); |
GetDlgItemText (dlg, IDC_CKEYGEN_EMAIL, email, sizeof (email)-1); |
640 |
if (!strchr (email, '@') || n < 3) { |
if (check_email_address (email) || n < 3) { |
641 |
msg_box (dlg, _("Please enter a valid e-mail address."), |
msg_box (dlg, _("Please enter a valid e-mail address."), |
642 |
_("Card Edit"), MB_ERR); |
_("Card Edit"), MB_ERR); |
643 |
return TRUE; |
return TRUE; |
644 |
} |
} |
645 |
n = GetDlgItemText (dlg, IDC_CKEYGEN_PASS, pass, sizeof (pass)-1); |
n = GetDlgItemText (dlg, IDC_CKEYGEN_PASS, pass, sizeof (pass)-1); |
646 |
if (!n && IsDlgButtonChecked (dlg, IDC_CKEYGEN_BACKUP)) { |
if (!n && IsDlgButtonChecked (dlg, IDC_CKEYGEN_BACKUP)) { |
647 |
msg_box (dlg, _("Please enter an off-card passphrase."), _("Card Edit"), MB_ERR); |
msg_box (dlg, _("Please enter an off-card passphrase."), |
648 |
|
_("Card Edit"), MB_ERR); |
649 |
return TRUE; |
return TRUE; |
650 |
} |
} |
651 |
n = item_get_text_length (dlg, IDC_CKEYGEN_COMMENT); |
n = item_get_text_length (dlg, IDC_CKEYGEN_COMMENT); |
665 |
free_pincb (&pincb); |
free_pincb (&pincb); |
666 |
return TRUE; |
return TRUE; |
667 |
} |
} |
668 |
ce = new GpgCardEdit (); |
ce = create_GpgCardEdit (); |
669 |
if (!ce) |
|
|
BUG (0); |
|
|
|
|
670 |
expires = !IsDlgButtonChecked (dlg, IDC_CKEYGEN_NEVER); |
expires = !IsDlgButtonChecked (dlg, IDC_CKEYGEN_NEVER); |
671 |
if (expires) { |
if (expires) { |
672 |
SYSTEMTIME st, ct; |
SYSTEMTIME st, ct; |
673 |
|
|
674 |
DateTime_GetSystemtime (GetDlgItem (dlg, IDC_CKEYGEN_VALID), &st); |
DateTime_GetSystemtime (GetDlgItem (dlg, IDC_CKEYGEN_VALID), &st); |
675 |
if (!keygen_check_date (&st)) { |
if (!keygen_check_date (&st)) { |
676 |
msg_box (dlg, _("The date you have chosen has already passed."), |
msg_box (dlg, _("The date you have chosen has already passed."), |
695 |
SetCursor (LoadCursor (NULL, IDC_WAIT)); |
SetCursor (LoadCursor (NULL, IDC_WAIT)); |
696 |
err = ce->genKey (card_flags, name, email, n? comment: NULL, |
err = ce->genKey (card_flags, name, email, n? comment: NULL, |
697 |
expires? valid : 0, NULL); |
expires? valid : 0, NULL); |
|
|
|
698 |
SetCursor (LoadCursor (NULL, IDC_ARROW)); |
SetCursor (LoadCursor (NULL, IDC_ARROW)); |
699 |
|
|
700 |
if (gpgme_err_code (err) == GPG_ERR_CANCELED) |
if (gpgme_err_code (err) == GPG_ERR_CANCELED) |
712 |
wipememory (pass, sizeof (pass)); |
wipememory (pass, sizeof (pass)); |
713 |
free_pincb (&pincb); |
free_pincb (&pincb); |
714 |
delete ce; |
delete ce; |
715 |
|
EndDialog (dlg, TRUE); |
716 |
return TRUE; |
return TRUE; |
717 |
|
|
718 |
case IDCANCEL: |
case IDCANCEL: |
719 |
EndDialog (dlg, FALSE); |
EndDialog (dlg, FALSE); |
720 |
return FALSE; |
return TRUE; |
721 |
} |
} |
722 |
break; |
break; |
723 |
} |
} |
814 |
return TRUE; |
return TRUE; |
815 |
} |
} |
816 |
|
|
817 |
ce = new GpgCardEdit (); |
ce = create_GpgCardEdit (); |
|
if (!ce) |
|
|
BUG (0); |
|
818 |
if (which == CARD_ADMIN_PIN) |
if (which == CARD_ADMIN_PIN) |
819 |
ce->setAdminPIN (pold); |
ce->setAdminPIN (pold); |
820 |
else |
else |