summaryrefslogtreecommitdiffstats
path: root/g10/call-agent.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2010-04-21 18:26:17 +0200
committerWerner Koch <wk@gnupg.org>2010-04-21 18:26:17 +0200
commita1412b05debe693e6aabaf2c2c337bc33f7dfd41 (patch)
tree214dc8928b73aaa385d69eaa180164318ff0bb93 /g10/call-agent.c
parentDisable card support for now (diff)
downloadgnupg2-a1412b05debe693e6aabaf2c2c337bc33f7dfd41.tar.xz
gnupg2-a1412b05debe693e6aabaf2c2c337bc33f7dfd41.zip
More changes on the way to remove secring.gpg.
Diffstat (limited to 'g10/call-agent.c')
-rw-r--r--g10/call-agent.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/g10/call-agent.c b/g10/call-agent.c
index 9379fcb52..7ae8fbba5 100644
--- a/g10/call-agent.c
+++ b/g10/call-agent.c
@@ -1294,23 +1294,25 @@ agent_get_s2k_count (unsigned long *r_count)
-/* Ask the agent whether a secret key with the given keygrip is
- known. */
+/* Ask the agent whether a secret key for the given public key is
+ available. Returns 0 if available. */
gpg_error_t
-agent_havekey (ctrl_t ctrl, const char *hexkeygrip)
+agent_probe_secret_key (ctrl_t ctrl, PKT_public_key *pk)
{
gpg_error_t err;
char line[ASSUAN_LINELENGTH];
+ char *hexgrip;
err = start_agent (ctrl, 0);
if (err)
return err;
- if (!hexkeygrip || strlen (hexkeygrip) != 40)
- return gpg_error (GPG_ERR_INV_VALUE);
+ err = hexkeygrip_from_pk (pk, &hexgrip);
+ if (err)
+ return err;
- snprintf (line, DIM(line)-1, "HAVEKEY %s", hexkeygrip);
- line[DIM(line)-1] = 0;
+ snprintf (line, sizeof line, "HAVEKEY %s", hexgrip);
+ xfree (hexgrip);
err = assuan_transact (agent_ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
return err;