/[winpt]/trunk/Src/wptPassphraseCB.cpp
ViewVC logotype

Diff of /trunk/Src/wptPassphraseCB.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 27 by twoaday, Tue Oct 18 07:57:13 2005 UTC revision 28 by twoaday, Thu Oct 20 12:35:59 2005 UTC
# Line 293  is_hexstring (const char * p) Line 293  is_hexstring (const char * p)
293  }  }
294  */  */
295    
296    
297    /* Extract the serial number from the card ID @id and return it. */
298    const char*
299    extract_serial_no (const char *id)
300    {
301        static char buf[8];
302        char *p;
303    
304        p = strchr (id, '/');
305        if (!p)
306            return NULL;
307        strncpy (buf, id+(p-id)-6, 6);
308        return buf;
309    }
310    
311    
312  /* Passphrase callback with the ability to support caching. */  /* Passphrase callback with the ability to support caching. */
313  gpgme_error_t  gpgme_error_t
314  passphrase_cb (void *hook, const char *uid_hint,  passphrase_cb (void *hook, const char *uid_hint,
# Line 348  passphrase_cb (void *hook, const char *u Line 364  passphrase_cb (void *hook, const char *u
364          /* if @passphrase_info contains 'OPENPGP' we assume a smart card          /* if @passphrase_info contains 'OPENPGP' we assume a smart card
365              has been used. */              has been used. */
366          if (strstr (passphrase_info, "OPENPGP")) {          if (strstr (passphrase_info, "OPENPGP")) {
367              char buf[16];              const char *s=passphrase_info;
368              memset (buf, 0, sizeof buf);              while (s && *s && *s != 'D')
369              strncpy (buf, "??", 2); /* XXX: fixme we need the serial no. */                  s++;
370              _snprintf (c->info, sizeof c->info-1,              _snprintf (c->info, sizeof c->info-1,
371                         _("Please enter the PIN to unlock your secret card key\n"                         _("Please enter the PIN to unlock your secret card key\n"
372                           "Card: %s"), buf);                           "Card: %s"), extract_serial_no (s));
373              c->is_card = 1;              c->is_card = 1;
374          }          }
375          else if (uid_hint)          else if (uid_hint)

Legend:
Removed from v.27  
changed lines
  Added in v.28

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26