Skip to content

GMimeCertificate API is problematic when verifying signatures from certificates with multiple user IDs #103

@dkg

Description

@dkg

The GMimeCertificate interface only presents a single (highest-validity) user ID and e-mail address.

Many certificates (both OpenPGP and X.509) have multiple user IDs and multiple e-mail addresses in them. My own OpenPGP certificate has three User IDs, two of which contain e-mail addresses:

pub   ed25519 2020-12-27 [C] [expires: 2023-12-24]
      C29F8A0C01F35E34D816AA5CE092EB3A5CA10DBA
uid            Daniel Kahn Gillmor
uid            <dkg@debian.org>
uid            <dkg@fifthhorseman.net>
sub   ed25519 2020-12-27 [S] [expires: 2023-12-24]
sub   cv25519 2020-12-27 [E] [expires: 2023-12-24]

For X.509, each subjectAltName can contain a distinct e-mail address.

When validating a signature over a particular e-mail message, one question a reasonable MUA wants to ask is "does the signature come from a certificate that has an e-mail address that matches the apparent sender of the message?"

But if the certificate information provided happens to pick the e-mail address from the wrong User ID, then it will look like a mismatch.

For example, if i send a signed e-mail from my dkg@fifthhorseman.net account, but if you happen to have my OpenPGP certificate stored in the order that it shows up here (with dkg@debian.org first), then the GMimeCertificate's email member will contain dkg@debian.org instead of the actual From: address.

How should a GMime user deal with this? I know that an API to supportmultiple e-mail addresses (and/or multiple User IDs) is more complex, as would be the storage data structure, and that would require an API change.

Another approach would be to retain some contextual information about the message being validated during signature validation, and to preferentially select e-mail addresses (of the highest validity) that do match the sending context.

This was all mentioned in the commit message d670174 back in 2017, but i don't think
anyone has done the work to provide the improved interface.

How should this be fixed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions