mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
gpg: Make use of the included key block in a signature.
* g10/import.c (read_key_from_file): Rename to ... (read_key_from_file_or_buffer): this and add new parameters. Adjust callers. (import_included_key_block): New. * g10/packet.h (PKT_signature): Add field flags.key_block. * g10/parse-packet.c (parse_signature): Set that flags. * g10/sig-check.c (check_signature2): Add parm forced_pk and change all callers. * g10/mainproc.c (do_check_sig): Ditto. (check_sig_and_print): Try the included key block if no key is available. -- This is is the second part to support the new Key Block subpacket. The idea is that after having received a signed mail, it is instantly possible to reply encrypted - without the need for any centralized infrastructure. There is one case where this does not work: A signed mail is received using a specified signer ID (e.g. using gpg --sender option) and the key block with only that user ID is thus imported. The next time a mail is received using the same key but with a different user ID; the signatures checks out using the key imported the last time. However, the new user id is not imported. Now when trying to reply to that last mail, no key will be found. We need to see whether we can update a key in such a case. GnuPG-bug-id: 4856 Signed-off-by: Werner Koch <wk@gnupg.org> Backported from master Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
d79ebee64e
commit
b42d9f540c
11 changed files with 254 additions and 56 deletions
|
@ -69,7 +69,7 @@ sig_check_dump_stats (void)
|
|||
int
|
||||
check_signature (ctrl_t ctrl, PKT_signature *sig, gcry_md_hd_t digest)
|
||||
{
|
||||
return check_signature2 (ctrl, sig, digest, NULL, NULL, NULL, NULL);
|
||||
return check_signature2 (ctrl, sig, digest, NULL, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -95,6 +95,9 @@ check_signature (ctrl_t ctrl, PKT_signature *sig, gcry_md_hd_t digest)
|
|||
* signature data from the version number through the hashed subpacket
|
||||
* data (inclusive) is hashed.")
|
||||
*
|
||||
* If FORCED_PK is not NULL this public key is used to verify the
|
||||
* signature and no other public key is looked up.
|
||||
*
|
||||
* If R_EXPIREDATE is not NULL, R_EXPIREDATE is set to the key's
|
||||
* expiry.
|
||||
*
|
||||
|
@ -112,7 +115,9 @@ check_signature (ctrl_t ctrl, PKT_signature *sig, gcry_md_hd_t digest)
|
|||
* Returns 0 on success. An error code otherwise. */
|
||||
gpg_error_t
|
||||
check_signature2 (ctrl_t ctrl,
|
||||
PKT_signature *sig, gcry_md_hd_t digest, u32 *r_expiredate,
|
||||
PKT_signature *sig, gcry_md_hd_t digest,
|
||||
PKT_public_key *forced_pk,
|
||||
u32 *r_expiredate,
|
||||
int *r_expired, int *r_revoked, PKT_public_key **r_pk)
|
||||
{
|
||||
int rc=0;
|
||||
|
@ -156,7 +161,7 @@ check_signature2 (ctrl_t ctrl,
|
|||
log_info(_("WARNING: signature digest conflict in message\n"));
|
||||
rc = gpg_error (GPG_ERR_GENERAL);
|
||||
}
|
||||
else if (get_pubkey_for_sig (ctrl, pk, sig))
|
||||
else if (get_pubkey_for_sig (ctrl, pk, sig, forced_pk))
|
||||
rc = gpg_error (GPG_ERR_NO_PUBKEY);
|
||||
else if (!gnupg_pk_is_allowed (opt.compliance, PK_USE_VERIFICATION,
|
||||
pk->pubkey_algo, pk->pkey,
|
||||
|
@ -923,7 +928,7 @@ check_signature_over_key_or_uid (ctrl_t ctrl, PKT_public_key *signer,
|
|||
if (IS_CERT (sig))
|
||||
signer->req_usage = PUBKEY_USAGE_CERT;
|
||||
|
||||
rc = get_pubkey_for_sig (ctrl, signer, sig);
|
||||
rc = get_pubkey_for_sig (ctrl, signer, sig, NULL);
|
||||
if (rc)
|
||||
{
|
||||
xfree (signer);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue