1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

* call-agent.c (gpgsm_agent_havekey): New.

* keylist.c (list_cert_colon): New arg HAVE_SECRET, print "crs"
when we know that the secret key is available.
(gpgsm_list_keys): New arg MODE, check whether a secret key is
available.  Changed all callers.
* gpgsm.c (main): New command --list-secret-keys.
* server.c (cmd_listsecretkeys): New.
(cmd_listkeys): Return secret keys with "crs" record.
This commit is contained in:
Werner Koch 2002-01-29 10:05:24 +00:00
parent 2d1d9d928c
commit cd30feaa8e
6 changed files with 89 additions and 14 deletions

View file

@ -456,3 +456,26 @@ gpgsm_agent_istrusted (KsbaCert cert)
rc = assuan_transact (agent_ctx, line, NULL, NULL, NULL, NULL);
return map_assuan_err (rc);
}
/* Ask the agent whether the a corresponding secret key is available
for the given keygrip */
int
gpgsm_agent_havekey (const char *hexkeygrip)
{
int rc;
char line[ASSUAN_LINELENGTH];
rc = start_agent ();
if (rc)
return rc;
if (!hexkeygrip || strlen (hexkeygrip) != 40)
return GNUPG_Invalid_Value;
snprintf (line, DIM(line)-1, "HAVEKEY %s", hexkeygrip);
line[DIM(line)-1] = 0;
rc = assuan_transact (agent_ctx, line, NULL, NULL, NULL, NULL);
return map_assuan_err (rc);
}