13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
* GNU General Public License for more details. |
* GNU General Public License for more details. |
|
* |
|
|
* You should have received a copy of the GNU General Public License |
|
|
* along with WinPT; if not, write to the Free Software Foundation, |
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
16 |
*/ |
*/ |
17 |
|
|
18 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
37 |
#include "wptCardEdit.h" |
#include "wptCardEdit.h" |
38 |
#include "wptCard.h" |
#include "wptCard.h" |
39 |
#include "wptContext.h" |
#include "wptContext.h" |
40 |
|
#include "StringBuffer.h" |
41 |
|
|
42 |
int keygen_check_date (SYSTEMTIME * st); |
int keygen_check_date (SYSTEMTIME * st); |
43 |
|
|
412 |
do_askpin (HWND dlg, int which, gpg_card_t card, |
do_askpin (HWND dlg, int which, gpg_card_t card, |
413 |
struct pin_cb_ctx_s *cb) |
struct pin_cb_ctx_s *cb) |
414 |
{ |
{ |
415 |
const char *s, *fmt; |
const char *s; |
|
const char *n1, *n2, *serial; |
|
416 |
char *p; |
char *p; |
|
size_t n; |
|
417 |
|
|
418 |
if( (which == CARD_ADMIN_PIN && cb->apin) || |
if( (which == CARD_ADMIN_PIN && cb->apin) || |
419 |
(which == CARD_USER_PIN && cb->upin) ) |
(which == CARD_USER_PIN && cb->upin) ) |
426 |
else |
else |
427 |
s = _("Please enter the PIN"); |
s = _("Please enter the PIN"); |
428 |
cb->which = which; |
cb->which = which; |
429 |
free_if_alloc( cb->info_text ); |
free_if_alloc (cb->info_text); |
430 |
if( card ) { |
if (card) { |
431 |
fmt = _("%s\nName: %s %s\nSerial-No: %s\n"); |
StringBuffer buf; |
432 |
n1 = card->givenname; |
|
433 |
n2 = card->surname; |
buf = s; |
434 |
if( !n1 || !n2 ) { |
buf = buf + "\nName: " + (card->givenname?card->givenname: "No"); |
435 |
n1 = "No"; n2 = "Name"; |
buf = buf + " " + (card->surname?card->surname : "Name"); |
436 |
} |
buf = buf + "\nSerial-No:" + card->serial; |
437 |
serial = card->serial; |
p = buf.getBufferCopy (); |
|
if (!serial) |
|
|
serial = "No Serial ID"; |
|
|
n = strlen( n1 ) + strlen( n2 ) + strlen( fmt ) + strlen( serial ) + 3; |
|
|
p = cb->info_text = new char[strlen (s)+n+1]; |
|
|
if( !p ) |
|
|
BUG (0); |
|
|
sprintf (p, fmt, s, n1, n2, serial); |
|
438 |
} |
} |
439 |
else |
else |
440 |
p = cb->info_text = m_strdup (s); |
p = cb->info_text = m_strdup (s); |