Currently, when a key selection scheme "Use email address of this identity to identify OpenPGP key" (pgpKeyMode == 0) is used Enigmail internally resolves the e-mail to fingerprint and uses that as -u flag to GnuPG.
If the e-mail address would be passed directly to GnuPG as an -u option then gpg would insert the e-mail as a Signer's User ID packet. On the receiving end gpg would use Web Key Directory to download the key to verify the signature.
This behavior is implemented in enigmailMsgComposeOverlay.js in getSenderUserId. I found out that using -1 (minus one) as pgpKeyMode EnigMail would pass the e-mail and gpg would correctly insert it into the signature, but this is kind-of a hack (abusing if-structure of the function).
The reason for this is that -u "email@address" is frequently not unique: GnuPG would use the first key on your keyring that matches the email address to sign the message. But this is usually the oldest (and thus often the weakest) of all keys.
We think that this is not desired - we want to use the best suitable key for this purpose and therefore do no longer use -u "email" bug -u "FPR".
In addition, we support Autocrypt - the key is included in the header, and therefore a WKD lookup should be required at all.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for taking the time to explain Patrick! I see bad GPG defaults require more workarounds.
I think the logic for selecting "the best" key should ultimately be built-in GnuPG as more tools use it, e.g. git, but even if it was, you support multiple versions of GPG so it's not immidiately helpful...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Currently, when a key selection scheme "Use email address of this identity to identify OpenPGP key" (pgpKeyMode == 0) is used Enigmail internally resolves the e-mail to fingerprint and uses that as
-uflag to GnuPG.If the e-mail address would be passed directly to GnuPG as an
-uoption then gpg would insert the e-mail as a Signer's User ID packet. On the receiving end gpg would use Web Key Directory to download the key to verify the signature.This behavior is implemented in
enigmailMsgComposeOverlay.jsingetSenderUserId. I found out that using -1 (minus one) aspgpKeyModeEnigMail would pass the e-mail and gpg would correctly insert it into the signature, but this is kind-of a hack (abusing if-structure of the function).Example signature with Signer's UID packet:
(this file can be passed to
gpg --list-packetsto see that there is a signer's user ID packet inserted).The reason for this is that -u "email@address" is frequently not unique: GnuPG would use the first key on your keyring that matches the email address to sign the message. But this is usually the oldest (and thus often the weakest) of all keys.
We think that this is not desired - we want to use the best suitable key for this purpose and therefore do no longer use -u "email" bug -u "FPR".
In addition, we support Autocrypt - the key is included in the header, and therefore a WKD lookup should be required at all.
Thanks for taking the time to explain Patrick! I see bad GPG defaults require more workarounds.
I think the logic for selecting "the best" key should ultimately be built-in GnuPG as more tools use it, e.g. git, but even if it was, you support multiple versions of GPG so it's not immidiately helpful...