mirror of
git://git.gnupg.org/gnupg.git
synced 2024-06-13 00:09:51 +02:00
2006-08-28 Marcus Brinkmann <marcus@g10code.de>
* app-openpgp.c (do_decipher, do_sign): Allow "OPENPGP.2" resp. "OPENPGP.1" for KEYIDSTR.
This commit is contained in:
parent
d8602648b8
commit
8ffa3b4cbb
|
@ -1,3 +1,8 @@
|
||||||
|
2006-08-28 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
|
* app-openpgp.c (do_decipher, do_sign): Allow "OPENPGP.2"
|
||||||
|
resp. "OPENPGP.1" for KEYIDSTR.
|
||||||
|
|
||||||
2006-08-21 Werner Koch <wk@g10code.com>
|
2006-08-21 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* pcsc-wrapper.c (handle_open, handle_close): Reset card and
|
* pcsc-wrapper.c (handle_open, handle_close): Reset card and
|
||||||
|
|
|
@ -2128,27 +2128,31 @@ do_sign (app_t app, const char *keyidstr, int hashalgo,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check whether an OpenPGP card of any version has been requested. */
|
/* Check whether an OpenPGP card of any version has been requested. */
|
||||||
if (strlen (keyidstr) < 32 || strncmp (keyidstr, "D27600012401", 12))
|
if (!strcmp (keyidstr, "OPENPGP.1"))
|
||||||
return gpg_error (GPG_ERR_INV_ID);
|
|
||||||
|
|
||||||
for (s=keyidstr, n=0; hexdigitp (s); s++, n++)
|
|
||||||
;
|
;
|
||||||
if (n != 32)
|
else if (strlen (keyidstr) < 32 || strncmp (keyidstr, "D27600012401", 12))
|
||||||
return gpg_error (GPG_ERR_INV_ID);
|
return gpg_error (GPG_ERR_INV_ID);
|
||||||
else if (!*s)
|
|
||||||
; /* no fingerprint given: we allow this for now. */
|
|
||||||
else if (*s == '/')
|
|
||||||
fpr = s + 1;
|
|
||||||
else
|
else
|
||||||
return gpg_error (GPG_ERR_INV_ID);
|
{
|
||||||
|
for (s=keyidstr, n=0; hexdigitp (s); s++, n++)
|
||||||
|
;
|
||||||
|
if (n != 32)
|
||||||
|
return gpg_error (GPG_ERR_INV_ID);
|
||||||
|
else if (!*s)
|
||||||
|
; /* no fingerprint given: we allow this for now. */
|
||||||
|
else if (*s == '/')
|
||||||
|
fpr = s + 1;
|
||||||
|
else
|
||||||
|
return gpg_error (GPG_ERR_INV_ID);
|
||||||
|
|
||||||
for (s=keyidstr, n=0; n < 16; s += 2, n++)
|
for (s=keyidstr, n=0; n < 16; s += 2, n++)
|
||||||
tmp_sn[n] = xtoi_2 (s);
|
tmp_sn[n] = xtoi_2 (s);
|
||||||
|
|
||||||
if (app->serialnolen != 16)
|
if (app->serialnolen != 16)
|
||||||
return gpg_error (GPG_ERR_INV_CARD);
|
return gpg_error (GPG_ERR_INV_CARD);
|
||||||
if (memcmp (app->serialno, tmp_sn, 16))
|
if (memcmp (app->serialno, tmp_sn, 16))
|
||||||
return gpg_error (GPG_ERR_WRONG_CARD);
|
return gpg_error (GPG_ERR_WRONG_CARD);
|
||||||
|
}
|
||||||
|
|
||||||
/* If a fingerprint has been specified check it against the one on
|
/* If a fingerprint has been specified check it against the one on
|
||||||
the card. This is allows for a meaningful error message in case
|
the card. This is allows for a meaningful error message in case
|
||||||
|
@ -2322,27 +2326,31 @@ do_decipher (app_t app, const char *keyidstr,
|
||||||
return gpg_error (GPG_ERR_INV_VALUE);
|
return gpg_error (GPG_ERR_INV_VALUE);
|
||||||
|
|
||||||
/* Check whether an OpenPGP card of any version has been requested. */
|
/* Check whether an OpenPGP card of any version has been requested. */
|
||||||
if (strlen (keyidstr) < 32 || strncmp (keyidstr, "D27600012401", 12))
|
if (!strcmp (keyidstr, "OPENPGP.2"))
|
||||||
return gpg_error (GPG_ERR_INV_ID);
|
|
||||||
|
|
||||||
for (s=keyidstr, n=0; hexdigitp (s); s++, n++)
|
|
||||||
;
|
;
|
||||||
if (n != 32)
|
else if (strlen (keyidstr) < 32 || strncmp (keyidstr, "D27600012401", 12))
|
||||||
return gpg_error (GPG_ERR_INV_ID);
|
return gpg_error (GPG_ERR_INV_ID);
|
||||||
else if (!*s)
|
|
||||||
; /* no fingerprint given: we allow this for now. */
|
|
||||||
else if (*s == '/')
|
|
||||||
fpr = s + 1;
|
|
||||||
else
|
else
|
||||||
return gpg_error (GPG_ERR_INV_ID);
|
{
|
||||||
|
for (s=keyidstr, n=0; hexdigitp (s); s++, n++)
|
||||||
for (s=keyidstr, n=0; n < 16; s += 2, n++)
|
;
|
||||||
tmp_sn[n] = xtoi_2 (s);
|
if (n != 32)
|
||||||
|
return gpg_error (GPG_ERR_INV_ID);
|
||||||
if (app->serialnolen != 16)
|
else if (!*s)
|
||||||
return gpg_error (GPG_ERR_INV_CARD);
|
; /* no fingerprint given: we allow this for now. */
|
||||||
if (memcmp (app->serialno, tmp_sn, 16))
|
else if (*s == '/')
|
||||||
return gpg_error (GPG_ERR_WRONG_CARD);
|
fpr = s + 1;
|
||||||
|
else
|
||||||
|
return gpg_error (GPG_ERR_INV_ID);
|
||||||
|
|
||||||
|
for (s=keyidstr, n=0; n < 16; s += 2, n++)
|
||||||
|
tmp_sn[n] = xtoi_2 (s);
|
||||||
|
|
||||||
|
if (app->serialnolen != 16)
|
||||||
|
return gpg_error (GPG_ERR_INV_CARD);
|
||||||
|
if (memcmp (app->serialno, tmp_sn, 16))
|
||||||
|
return gpg_error (GPG_ERR_WRONG_CARD);
|
||||||
|
}
|
||||||
|
|
||||||
/* If a fingerprint has been specified check it against the one on
|
/* If a fingerprint has been specified check it against the one on
|
||||||
the card. This is allows for a meaningful error message in case
|
the card. This is allows for a meaningful error message in case
|
||||||
|
|
Loading…
Reference in New Issue
Block a user