mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
gpg: Improve 'General key info' line of --card-status.
* g10/keylist.c (print_pubkey_info): Print either "pub" or "sub". * g10/getkey.c (get_pubkey_byfprint): Add optional arg R_KEYBLOCK. * g10/keyid.c (keyid_from_fingerprint): Adjust for change. * g10/revoke.c (gen_desig_revoke): Adjust for change. * g10/card-util.c (card_status): Simplify by using new arg. Align card-no string. * g10/card-util.c (card_status): Remove not used GnuPG-1 code. -- This now prints "sub" if the first used card key is actually a subkey. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
173b26c8f8
commit
874ef16e70
6 changed files with 35 additions and 40 deletions
22
g10/getkey.c
22
g10/getkey.c
|
@ -968,17 +968,26 @@ get_pubkey_byfpr (PKT_public_key *pk, const byte *fpr)
|
|||
}
|
||||
|
||||
|
||||
/* Search for a key with the given fingerprint.
|
||||
/* Search for a key with the given fingerprint. The caller need to
|
||||
* prove an allocated public key object at PK. If R_KEYBLOCK is not
|
||||
* NULL the entire keyblock is stored there and the caller needs to
|
||||
* call release_kbnode() on it. Note that this function does an exact
|
||||
* search and thus the public key stored at PK may be a copy of a
|
||||
* subkey.
|
||||
*
|
||||
* FIXME:
|
||||
* We should replace this with the _byname function. This can be done
|
||||
* by creating a userID conforming to the unified fingerprint style.
|
||||
*/
|
||||
int
|
||||
get_pubkey_byfprint (PKT_public_key * pk,
|
||||
get_pubkey_byfprint (PKT_public_key *pk, kbnode_t *r_keyblock,
|
||||
const byte * fprint, size_t fprint_len)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (r_keyblock)
|
||||
*r_keyblock = NULL;
|
||||
|
||||
if (fprint_len == 20 || fprint_len == 16)
|
||||
{
|
||||
struct getkey_ctx_s ctx;
|
||||
|
@ -994,7 +1003,14 @@ get_pubkey_byfprint (PKT_public_key * pk,
|
|||
memcpy (ctx.items[0].u.fpr, fprint, fprint_len);
|
||||
rc = lookup (&ctx, &kb, 0);
|
||||
if (!rc && pk)
|
||||
pk_from_block (&ctx, pk, kb);
|
||||
{
|
||||
pk_from_block (&ctx, pk, kb);
|
||||
if (r_keyblock)
|
||||
{
|
||||
*r_keyblock = kb;
|
||||
kb = NULL;
|
||||
}
|
||||
}
|
||||
release_kbnode (kb);
|
||||
get_pubkey_end (&ctx);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue