mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
gpg: During secret key import print "sec" instead of "pub".
* g10/keyedit.c (show_basic_key_info): New arg 'print_sec'. Remove
useless code for "sub" and "ssb".
* g10/import.c (import_one): Pass FROM_SK to show_basic_key_info. Do
not print the first keyinfo in FROM_SK mode.
printing.
--
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit f64477db86
)
This commit is contained in:
parent
184fbf014a
commit
db2d75f1ff
4 changed files with 25 additions and 16 deletions
|
@ -3662,13 +3662,14 @@ show_key_with_all_names (ctrl_t ctrl, estream_t fp,
|
|||
|
||||
|
||||
/* Display basic key information. This function is suitable to show
|
||||
information on the key without any dependencies on the trustdb or
|
||||
any other internal GnuPG stuff. KEYBLOCK may either be a public or
|
||||
a secret key. This function may be called with KEYBLOCK containing
|
||||
secret keys and thus the printing of "pub" vs. "sec" does only
|
||||
depend on the packet type and not by checking with gpg-agent. */
|
||||
* information on the key without any dependencies on the trustdb or
|
||||
* any other internal GnuPG stuff. KEYBLOCK may either be a public or
|
||||
* a secret key. This function may be called with KEYBLOCK containing
|
||||
* secret keys and thus the printing of "pub" vs. "sec" does only
|
||||
* depend on the packet type and not by checking with gpg-agent. If
|
||||
* PRINT_SEC ist set "sec" is printed instead of "pub". */
|
||||
void
|
||||
show_basic_key_info (ctrl_t ctrl, kbnode_t keyblock)
|
||||
show_basic_key_info (ctrl_t ctrl, kbnode_t keyblock, int print_sec)
|
||||
{
|
||||
KBNODE node;
|
||||
int i;
|
||||
|
@ -3681,13 +3682,17 @@ show_basic_key_info (ctrl_t ctrl, kbnode_t keyblock)
|
|||
|| node->pkt->pkttype == PKT_SECRET_KEY)
|
||||
{
|
||||
PKT_public_key *pk = node->pkt->pkt.public_key;
|
||||
const char *tag;
|
||||
|
||||
if (node->pkt->pkttype == PKT_SECRET_KEY || print_sec)
|
||||
tag = "sec";
|
||||
else
|
||||
tag = "pub";
|
||||
|
||||
/* Note, we use the same format string as in other show
|
||||
functions to make the translation job easier. */
|
||||
tty_printf ("%s %s/%s ",
|
||||
node->pkt->pkttype == PKT_PUBLIC_KEY ? "pub" :
|
||||
node->pkt->pkttype == PKT_PUBLIC_SUBKEY ? "sub" :
|
||||
node->pkt->pkttype == PKT_SECRET_KEY ? "sec" :"ssb",
|
||||
tag,
|
||||
pubkey_string (pk, pkstrbuf, sizeof pkstrbuf),
|
||||
keystr_from_pk (pk));
|
||||
tty_printf (_("created: %s"), datestr_from_pk (pk));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue