mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-18 14:17:03 +01:00
scd:piv: Allow the keygrip as alternative to a keyref.
* scd/app-piv.c (find_dobj_by_keyref): Allow the keygrip as input. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
c8d739a356
commit
947b44e835
@ -1366,7 +1366,7 @@ find_dobj_by_keyref (app_t app, const char *keyref)
|
|||||||
|
|
||||||
(void)app;
|
(void)app;
|
||||||
|
|
||||||
if (!ascii_strncasecmp (keyref, "PIV.", 4))
|
if (!ascii_strncasecmp (keyref, "PIV.", 4)) /* Standard keyref */
|
||||||
{
|
{
|
||||||
keyref += 4;
|
keyref += 4;
|
||||||
for (i=0; data_objects[i].tag; i++)
|
for (i=0; data_objects[i].tag; i++)
|
||||||
@ -1376,7 +1376,7 @@ find_dobj_by_keyref (app_t app, const char *keyref)
|
|||||||
return data_objects + i;
|
return data_objects + i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp (keyref, "2.16.840.1.101.3.7.", 19))
|
else if (!strncmp (keyref, "2.16.840.1.101.3.7.", 19)) /* OID */
|
||||||
{
|
{
|
||||||
keyref += 19;
|
keyref += 19;
|
||||||
for (i=0; data_objects[i].tag; i++)
|
for (i=0; data_objects[i].tag; i++)
|
||||||
@ -1386,6 +1386,26 @@ find_dobj_by_keyref (app_t app, const char *keyref)
|
|||||||
return data_objects + i;
|
return data_objects + i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (strlen (keyref) == 40) /* A keygrip */
|
||||||
|
{
|
||||||
|
char *keygripstr = NULL;
|
||||||
|
int tag, dummy_got_cert;
|
||||||
|
|
||||||
|
for (i=0; (tag=data_objects[i].tag); i++)
|
||||||
|
{
|
||||||
|
if (!data_objects[i].keypair)
|
||||||
|
continue;
|
||||||
|
xfree (keygripstr);
|
||||||
|
if (get_keygrip_by_tag (app, tag, &keygripstr, &dummy_got_cert))
|
||||||
|
continue;
|
||||||
|
if (!strcmp (keygripstr, keyref))
|
||||||
|
{
|
||||||
|
xfree (keygripstr);
|
||||||
|
return data_objects + i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xfree (keygripstr);
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user