diff options
author | Werner Koch <[email protected]> | 2024-08-12 12:50:08 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2024-08-12 12:50:08 +0000 |
commit | 882ab7fef9bf4440900c32d7463469307224f11a (patch) | |
tree | 9544c758dc3929bd2b5cd0f45d72d072c1f705fb /g10/keydb.h | |
parent | agent: When diverting to a card show the name of unsupported algos. (diff) | |
download | gnupg-882ab7fef9bf4440900c32d7463469307224f11a.tar.gz gnupg-882ab7fef9bf4440900c32d7463469307224f11a.zip |
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.
Diffstat (limited to 'g10/keydb.h')
-rw-r--r-- | g10/keydb.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/g10/keydb.h b/g10/keydb.h index d96debeb7..2cdc8f2e5 100644 --- a/g10/keydb.h +++ b/g10/keydb.h @@ -351,6 +351,8 @@ int get_pubkey_fast (ctrl_t ctrl, PKT_public_key *pk, u32 *keyid); kbnode_t get_pubkeyblock_for_sig (ctrl_t ctrl, PKT_signature *sig); /* Return the key block for the key with KEYID. */ +#define GET_PUBKEYBLOCK_FLAG_ADSK 1 /* Allow returning ADSK key. */ +kbnode_t get_pubkeyblock_ext (ctrl_t ctrl, u32 *keyid, unsigned int flags); kbnode_t get_pubkeyblock (ctrl_t ctrl, u32 *keyid); /* A list used by get_pubkeys to gather all of the matches. */ |