aboutsummaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
Diffstat (limited to 'g10')
-rw-r--r--g10/call-agent.c23
-rw-r--r--g10/call-agent.h3
-rw-r--r--g10/card-util.c3
3 files changed, 29 insertions, 0 deletions
diff --git a/g10/call-agent.c b/g10/call-agent.c
index fd9f8e079..d416a72f8 100644
--- a/g10/call-agent.c
+++ b/g10/call-agent.c
@@ -1414,6 +1414,29 @@ agent_scd_readkey (const char *keyrefstr, gcry_sexp_t *r_result)
}
+/* This can be called for a quick and dirty update/creation of the
+ * shadow key stubs. */
+gpg_error_t
+agent_update_shadow_keys (void)
+{
+ gpg_error_t err;
+
+ err = start_agent (NULL, 1);
+ if (err)
+ return err;
+
+ assuan_transact (agent_ctx, "READKEY --card --no-data -- $SIGNKEYID",
+ NULL, NULL, NULL, NULL, NULL, NULL);
+ assuan_transact (agent_ctx, "READKEY --card --no-data -- $ENCRKEYID",
+ NULL, NULL, NULL, NULL, NULL, NULL);
+ assuan_transact (agent_ctx, "READKEY --card --no-data -- $AUTHKEYID",
+ NULL, NULL, NULL, NULL, NULL, NULL);
+
+ return err;
+}
+
+
+
struct card_cardlist_parm_s {
int error;
diff --git a/g10/call-agent.h b/g10/call-agent.h
index 76edb699a..dbc6e2fe9 100644
--- a/g10/call-agent.h
+++ b/g10/call-agent.h
@@ -124,6 +124,9 @@ int agent_scd_readcert (const char *certidstr,
/* Send a READKEY command to the SCdaemon. */
gpg_error_t agent_scd_readkey (const char *keyrefstr, gcry_sexp_t *r_result);
+/* Update common shadow key stubs. */
+gpg_error_t agent_update_shadow_keys (void);
+
/* Change the PIN of an OpenPGP card or reset the retry counter. */
int agent_scd_change_pin (int chvno, const char *serialno);
diff --git a/g10/card-util.c b/g10/card-util.c
index 03a873244..f54e5e1c4 100644
--- a/g10/card-util.c
+++ b/g10/card-util.c
@@ -420,6 +420,9 @@ current_card_status (ctrl_t ctrl, estream_t fp,
else
tty_fprintf (fp, "Application type .: %s\n", name2);
+ /* Try to update/create the shadow key here for non-OpenPGP cards. */
+ agent_update_shadow_keys ();
+
agent_release_card_info (&info);
xfree (pk);
return;