Home GnuPG
Diffusion GnuPG 1af3c098314a

gpg: Improve decryption diagnostic for an ADSK key.

Description

gpg: Improve decryption diagnostic for an ADSK key.

* g10/keydb.h (GET_PUBKEYBLOCK_FLAG_ADSK): New constant.
* g10/packet.h (PUBKEY_USAGE_XENC_MASK): New constant.
* g10/pubkey-enc.c (get_session_key): Consider an ADSK also as "marked
for encryption use".
(get_it): Print a note if an ADSK key was used.  Use the new
get_pubkeyblock flag.
* g10/getkey.c (struct getkey_ctx_s): Add field allow_adsk.
(get_pubkeyblock): Factor all code out to ...
(get_pubkeyblock_ext): new.
(finish_lookup): Add new arg allow_adsk and make use of it.

This patch solves two purposes:

  • We write a note that the ADSK key was used for decryption
  • We avoid running into a "oops: public key not found for preference check\n" due to ADSK keys. The error is mostly harmless but lets gpg return with an exit code of 2.

Backported-from-master: 6fa4d7973db34d118b7735d5a3d1aa8cc4412f46

Details

Provenance
wernerAuthored on Aug 12 2024, 2:50 PM
Parents
rG6fa4d7973db3: agent: When diverting to a card show the name of unsupported algos.
Branches
Unknown
Tags
Unknown