mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
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_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: 882ab7fef9
This commit is contained in:
parent
6f78219d0f
commit
861dc01994
4 changed files with 37 additions and 8 deletions
|
@ -369,7 +369,7 @@ get_it (ctrl_t ctrl,
|
|||
{
|
||||
PKT_public_key *pk = NULL;
|
||||
PKT_public_key *mainpk = NULL;
|
||||
KBNODE pkb = get_pubkeyblock (ctrl, keyid);
|
||||
KBNODE pkb = get_pubkeyblock_ext (ctrl, keyid, GET_PUBKEYBLOCK_FLAG_ADSK);
|
||||
|
||||
if (!pkb)
|
||||
{
|
||||
|
@ -418,6 +418,13 @@ get_it (ctrl_t ctrl,
|
|||
}
|
||||
}
|
||||
|
||||
if (pk && !(pk->pubkey_usage & PUBKEY_USAGE_ENC)
|
||||
&& (pk->pubkey_usage & PUBKEY_USAGE_RENC))
|
||||
{
|
||||
log_info (_("Note: ADSK key has been used for decryption"));
|
||||
log_printf ("\n");
|
||||
}
|
||||
|
||||
if (pk && pk->flags.revoked)
|
||||
{
|
||||
log_info (_("Note: key has been revoked"));
|
||||
|
@ -435,7 +442,7 @@ get_it (ctrl_t ctrl,
|
|||
|
||||
/* Note that we do not want to create a trustdb just for
|
||||
* getting the ownertrust: If there is no trustdb there can't
|
||||
* be ulitmately trusted key anyway and thus the ownertrust
|
||||
* be ultimately trusted key anyway and thus the ownertrust
|
||||
* value is irrelevant. */
|
||||
write_status_printf (STATUS_DECRYPTION_KEY, "%s %s %c",
|
||||
pkhex, mainpkhex,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue