summaryrefslogtreecommitdiffstats
path: root/g10/call-agent.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2021-04-23 08:47:06 +0200
committerWerner Koch <wk@gnupg.org>2021-04-23 08:50:39 +0200
commit50293ec2ebf2a997dbad9a47166d694efcc0709a (patch)
tree46e5a428c73cea0a3b44bd9dab06a74fb69bb458 /g10/call-agent.c
parentagent: Require verbose level 2 for handler started/terminated notices. (diff)
downloadgnupg2-50293ec2ebf2a997dbad9a47166d694efcc0709a.tar.xz
gnupg2-50293ec2ebf2a997dbad9a47166d694efcc0709a.zip
gpg: Allow decryption w/o public key but with correct card inserted.
* agent/command.c (cmd_readkey): Add option --no-data and special handling for $SIGNKEYID and $AUTHKEYID. * g10/call-agent.c (agent_scd_getattr): Create shadow keys for KEY-FPR output. * g10/skclist.c (enum_secret_keys): Automagically get a missing public key for the current card. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/call-agent.c')
-rw-r--r--g10/call-agent.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/g10/call-agent.c b/g10/call-agent.c
index fb80489b2..83355454a 100644
--- a/g10/call-agent.c
+++ b/g10/call-agent.c
@@ -1232,6 +1232,16 @@ agent_scd_getattr (const char *name, struct agent_card_info_s *info)
parm.ctx = agent_ctx;
rc = assuan_transact (agent_ctx, line, NULL, NULL, default_inq_cb, &parm,
learn_status_cb, info);
+ if (!rc && !strcmp (name, "KEY-FPR"))
+ {
+ /* Let the agent create the shadow keys if not yet done. */
+ if (info->fpr1len)
+ assuan_transact (agent_ctx, "READKEY --card --no-data -- $SIGNKEYID",
+ NULL, NULL, NULL, NULL, NULL, NULL);
+ if (info->fpr2len)
+ assuan_transact (agent_ctx, "READKEY --card --no-data -- $ENCRKEYID",
+ NULL, NULL, NULL, NULL, NULL, NULL);
+ }
return rc;
}