diff options
author | Werner Koch <[email protected]> | 2002-01-29 10:05:24 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2002-01-29 10:05:24 +0000 |
commit | cd30feaa8ebb37f98742228573da81e7ac8472aa (patch) | |
tree | 8c9b3d0dc1b48f8eefb7f32d0425393646736e50 /sm/call-agent.c | |
parent | * findkey.c (agent_key_available): New. (diff) | |
download | gnupg-cd30feaa8ebb37f98742228573da81e7ac8472aa.tar.gz gnupg-cd30feaa8ebb37f98742228573da81e7ac8472aa.zip |
* 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.
Diffstat (limited to 'sm/call-agent.c')
-rw-r--r-- | sm/call-agent.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sm/call-agent.c b/sm/call-agent.c index 8efa539ea..ec294f6d6 100644 --- a/sm/call-agent.c +++ b/sm/call-agent.c @@ -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); +} |