aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2023-04-20 10:10:54 +0000
committerWerner Koch <[email protected]>2023-04-20 10:10:54 +0000
commite1663c045049d801493a26ab2e3512209e448610 (patch)
tree14f6af9b5887e4ea5fd620952611b5631a296208
parentUse keyboxd on a fresh install also on Windows. (diff)
downloadgnupg-e1663c045049d801493a26ab2e3512209e448610.tar.gz
gnupg-e1663c045049d801493a26ab2e3512209e448610.zip
gpg: New command "openpgp" for --card-edit.
* g10/card-util.c (current_card_status): Print a hint for fishy outputs. (enum cmdids): Add cmdOPENPGP. (cmds): Add "openpgp". (card_edit): Implement that command. -- If a Yubikey has been used in PIV mode the initial listing does not look correct. Although we explicitly switch to the OpenPGP app when needed, we don't want to do this in listing mode. Instead we offer a new command "openpgp" to force the openpgp mode. The ultimate goal will be to enhance the gpg-card tool to completely take over the --card-edit features. But we are not yet there. GnuPG-bug-id: 6462
-rw-r--r--doc/gpg.texi11
-rw-r--r--g10/card-util.c16
2 files changed, 22 insertions, 5 deletions
diff --git a/doc/gpg.texi b/doc/gpg.texi
index eb7c35cac..9fdabc743 100644
--- a/doc/gpg.texi
+++ b/doc/gpg.texi
@@ -399,10 +399,13 @@ this command may change with new releases.
@opindex edit-card
@itemx --card-edit
@opindex card-edit
-Present a menu to work with a smartcard. The subcommand "help" provides
-an overview on available commands. For a detailed description, please
-see the Card HOWTO at
-https://gnupg.org/documentation/howtos.html#GnuPG-cardHOWTO .
+Present a menu to work with a smartcard. The subcommand "help"
+provides an overview on available commands. For a detailed
+description, please see the Card HOWTO at
+https://gnupg.org/documentation/howtos.html#GnuPG-cardHOWTO . Please
+note that the command "openpgp" can be used to switch to the OpenPGP
+application of cards which by default are presenting another
+application (e.g. PIV).
@item --card-status
@opindex card-status
diff --git a/g10/card-util.c b/g10/card-util.c
index d8f1b960a..a3297fb71 100644
--- a/g10/card-util.c
+++ b/g10/card-util.c
@@ -705,6 +705,14 @@ current_card_status (ctrl_t ctrl, estream_t fp,
}
else
tty_fprintf (fp, "[none]\n");
+
+ if (!info.manufacturer_name)
+ {
+ tty_fprintf (fp, "\n");
+ tty_fprintf (fp, _("Please try command \"%s\""
+ " if the listing does not look correct\n"),
+ "openpgp");
+ }
}
release_kbnode (keyblock);
@@ -2243,7 +2251,7 @@ enum cmdids
cmdNAME, cmdURL, cmdFETCH, cmdLOGIN, cmdLANG, cmdSEX, cmdCAFPR,
cmdFORCESIG, cmdGENERATE, cmdPASSWD, cmdPRIVATEDO, cmdWRITECERT,
cmdREADCERT, cmdUNBLOCK, cmdFACTORYRESET, cmdKDFSETUP,
- cmdKEYATTR, cmdUIF,
+ cmdKEYATTR, cmdUIF, cmdOPENPGP,
cmdINVCMD
};
@@ -2281,6 +2289,7 @@ static struct
N_("setup KDF for PIN authentication (on/single/off)")},
{ "key-attr", cmdKEYATTR, 1, N_("change the key attribute")},
{ "uif", cmdUIF, 1, N_("change the User Interaction Flag")},
+ { "openpgp", cmdOPENPGP, 0, N_("switch to the OpenPGP app")},
/* Note, that we do not announce these command yet. */
{ "privatedo", cmdPRIVATEDO, 0, NULL },
{ "readcert", cmdREADCERT, 0, NULL },
@@ -2580,6 +2589,11 @@ card_edit (ctrl_t ctrl, strlist_t commands)
uif (arg_number, arg_rest);
break;
+ case cmdOPENPGP:
+ agent_scd_switchapp ("openpgp");
+ redisplay = 1;
+ break;
+
case cmdQUIT:
goto leave;