mirror of
git://git.gnupg.org/gnupg.git
synced 2025-03-02 21:11:05 +01:00
gpg: For decryption, support use of a key with no 'encrypt' usage.
* g10/pubkey-enc.c (get_session_key): Don't skip at no PUBKEY_USAGE_ENC. Emit information the key has no 'encrypt' usage. -- GnuPG-bug-id: 4246 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
b4501fc826
commit
31ae0718ba
@ -91,9 +91,6 @@ get_session_key (ctrl_t ctrl, struct pubkey_enc_list *list, DEK *dek)
|
||||
if (err)
|
||||
break;
|
||||
|
||||
if (!(sk->pubkey_usage & PUBKEY_USAGE_ENC))
|
||||
continue;
|
||||
|
||||
/* Check compliance. */
|
||||
if (! gnupg_pk_is_allowed (opt.compliance, PK_USE_DECRYPTION,
|
||||
sk->pubkey_algo, 0,
|
||||
@ -144,7 +141,10 @@ get_session_key (ctrl_t ctrl, struct pubkey_enc_list *list, DEK *dek)
|
||||
}
|
||||
else if (opt.try_all_secrets
|
||||
|| (k->keyid[0] == keyid[0] && k->keyid[1] == keyid[1]))
|
||||
;
|
||||
{
|
||||
if (!opt.quiet && !(sk->pubkey_usage & PUBKEY_USAGE_ENC))
|
||||
log_info (_("using the key with no 'encrypt' usage.\n"));
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
@ -153,7 +153,11 @@ get_session_key (ctrl_t ctrl, struct pubkey_enc_list *list, DEK *dek)
|
||||
if (!err)
|
||||
{
|
||||
if (!opt.quiet && !k->keyid[0] && !k->keyid[1])
|
||||
log_info (_("okay, we are the anonymous recipient.\n"));
|
||||
{
|
||||
log_info (_("okay, we are the anonymous recipient.\n"));
|
||||
if (!(sk->pubkey_usage & PUBKEY_USAGE_ENC))
|
||||
log_info (_("using the key with no 'encrypt' usage.\n"));
|
||||
}
|
||||
search_for_secret_keys = 0;
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user