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

gpg: Make card key generation work again.

* g10/call-agent.c (agent_scd_learn): Rename from agent_learn.
(agent_learn): New.
* g10/keygen.c (gen_card_key): Call new agent-learn.
--

Without a shadow key we can't create the self-signatures.  Thus we
need to issue the learn command after each key generation.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2014-10-19 14:09:04 +02:00
parent 6d9491842d
commit 1b8decc476
4 changed files with 44 additions and 5 deletions

View file

@ -639,9 +639,9 @@ learn_status_cb (void *opaque, const char *line)
return 0;
}
/* Call the agent to learn about a smartcard */
/* Call the scdaemon to learn about a smartcard */
int
agent_learn (struct agent_card_info_s *info)
agent_scd_learn (struct agent_card_info_s *info)
{
int rc;
struct default_inq_parm_s parm;
@ -677,6 +677,29 @@ agent_learn (struct agent_card_info_s *info)
}
/* Call the agent to learn about the current smartcard. This is
currently only used to have the agent create the shadow key. */
gpg_error_t
agent_learn (void)
{
gpg_error_t err;
struct default_inq_parm_s parm;
memset (&parm, 0, sizeof parm);
err = start_agent (NULL, 1);
if (err)
return err;
parm.ctx = agent_ctx;
err = assuan_transact (agent_ctx, "LEARN",
dummy_data_cb, NULL, default_inq_cb, &parm,
NULL, NULL);
return err;
}
int
agent_keytocard (const char *hexgrip, int keyno, int force,
const char *serialno, const char *timestamp)