mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
scd: New standard attributes $ENCRKEYID and $SIGNKEYID.
* g10/call-agent.c (agent_scd_keypairinfo): Use --keypairinfo. * sm/call-agent.c (gpgsm_agent_scd_keypairinfo): Ditto. * scd/app-openpgp.c (do_getattr): Add attributes "$ENCRKEYID" and "$SIGNKEYID". * scd/app-piv.c (do_getattr): Ditto. -- We already have $AUTHKEYID to locate the keyref of the key to be used with ssh. It will also be useful to have default keyref for encryption and signing. For example, this will allow us to repalce the use of "OPENPGP.2" by a app type specific keyref. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
1f688e0d1d
commit
2b1135cf92
@ -839,7 +839,7 @@ agent_scd_keypairinfo (ctrl_t ctrl, strlist_t *r_list)
|
|||||||
memset (&inq_parm, 0, sizeof inq_parm);
|
memset (&inq_parm, 0, sizeof inq_parm);
|
||||||
inq_parm.ctx = agent_ctx;
|
inq_parm.ctx = agent_ctx;
|
||||||
|
|
||||||
err = assuan_transact (agent_ctx, "SCD LEARN --force",
|
err = assuan_transact (agent_ctx, "SCD LEARN --keypairinfo",
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
default_inq_cb, &inq_parm,
|
default_inq_cb, &inq_parm,
|
||||||
scd_keypairinfo_status_cb, &list);
|
scd_keypairinfo_status_cb, &list);
|
||||||
|
@ -987,6 +987,8 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
|
|||||||
{ "PRIVATE-DO-3", 0x0103 },
|
{ "PRIVATE-DO-3", 0x0103 },
|
||||||
{ "PRIVATE-DO-4", 0x0104 },
|
{ "PRIVATE-DO-4", 0x0104 },
|
||||||
{ "$AUTHKEYID", 0x0000, -3 },
|
{ "$AUTHKEYID", 0x0000, -3 },
|
||||||
|
{ "$ENCRKEYID", 0x0000, -6 },
|
||||||
|
{ "$SIGNKEYID", 0x0000, -7 },
|
||||||
{ "$DISPSERIALNO",0x0000, -4 },
|
{ "$DISPSERIALNO",0x0000, -4 },
|
||||||
{ "UIF-1", 0x00D6, 0 },
|
{ "UIF-1", 0x00D6, 0 },
|
||||||
{ "UIF-2", 0x00D7, 0 },
|
{ "UIF-2", 0x00D7, 0 },
|
||||||
@ -1071,6 +1073,18 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
|
|||||||
send_key_attr (ctrl, app, table[idx].name, i);
|
send_key_attr (ctrl, app, table[idx].name, i);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (table[idx].special == -6)
|
||||||
|
{
|
||||||
|
char const tmp[] = "OPENPGP.2";
|
||||||
|
send_status_info (ctrl, table[idx].name, tmp, strlen (tmp), NULL, 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (table[idx].special == -7)
|
||||||
|
{
|
||||||
|
char const tmp[] = "OPENPGP.1";
|
||||||
|
send_status_info (ctrl, table[idx].name, tmp, strlen (tmp), NULL, 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
relptr = get_one_do (app, table[idx].tag, &value, &valuelen, &rc);
|
relptr = get_one_do (app, table[idx].tag, &value, &valuelen, &rc);
|
||||||
if (relptr)
|
if (relptr)
|
||||||
|
@ -812,7 +812,9 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
|
|||||||
int special;
|
int special;
|
||||||
} table[] = {
|
} table[] = {
|
||||||
{ "SERIALNO", 0x0000, -1 },
|
{ "SERIALNO", 0x0000, -1 },
|
||||||
{ "$AUTHKEYID", 0x0000, -2 }, /* Default key for ssh. */
|
{ "$AUTHKEYID", 0x0000, -2 }, /* Default ssh key. */
|
||||||
|
{ "$ENCRKEYID", 0x0000, -6 }, /* Default encryption key. */
|
||||||
|
{ "$SIGNKEYID", 0x0000, -7 }, /* Default signing key. */
|
||||||
{ "$DISPSERIALNO",0x0000, -3 },
|
{ "$DISPSERIALNO",0x0000, -3 },
|
||||||
{ "CHV-STATUS", 0x0000, -4 },
|
{ "CHV-STATUS", 0x0000, -4 },
|
||||||
{ "CHV-USAGE", 0x007E, -5 }
|
{ "CHV-USAGE", 0x007E, -5 }
|
||||||
@ -883,6 +885,16 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
|
|||||||
xfree (relptr);
|
xfree (relptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (table[idx].special == -6)
|
||||||
|
{
|
||||||
|
char const tmp[] = "PIV.9D"; /* Key Management. */
|
||||||
|
send_status_info (ctrl, table[idx].name, tmp, strlen (tmp), NULL, 0);
|
||||||
|
}
|
||||||
|
else if (table[idx].special == -7)
|
||||||
|
{
|
||||||
|
char const tmp[] = "PIV.9C"; /* Digital Signature. */
|
||||||
|
send_status_info (ctrl, table[idx].name, tmp, strlen (tmp), NULL, 0);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
relptr = get_one_do (app, table[idx].tag, &value, &valuelen, &err);
|
relptr = get_one_do (app, table[idx].tag, &value, &valuelen, &err);
|
||||||
|
@ -836,7 +836,7 @@ gpgsm_agent_scd_keypairinfo (ctrl_t ctrl, strlist_t *r_list)
|
|||||||
inq_parm.ctrl = ctrl;
|
inq_parm.ctrl = ctrl;
|
||||||
inq_parm.ctx = agent_ctx;
|
inq_parm.ctx = agent_ctx;
|
||||||
|
|
||||||
rc = assuan_transact (agent_ctx, "SCD LEARN --force",
|
rc = assuan_transact (agent_ctx, "SCD LEARN --keypairinfo",
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
default_inq_cb, &inq_parm,
|
default_inq_cb, &inq_parm,
|
||||||
scd_keypairinfo_status_cb, &list);
|
scd_keypairinfo_status_cb, &list);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user