Mailing List Archive

Trust model tofu+pgp and User ID in Signer's UID packet
Hello,

I think I found an issue with how GnuPG handles signatures with Signer's
UID field and trust model tofu+pgp.

There was an issue reported to OpenKeychain [0] that messages generated
by it are not trusted by GnuPG. The problem was that messages produced
by K-9 mail and OpenKeychain are decrypted by GnuPG with the following
warning:

gpg: WARNING: We do NOT trust this key!
gpg: The signature is probably a FORGERY.

Even though the key is marked with "tofu-policy good" and looks fine in
"gpg --edit-key".

I did run the decryption with "--debug-level guru" and spotted the
following message:

gpg: DBG: TOFU: only considering user id: 'John Doe <john@example.com>'
gpg: DBG: TOFU: skipping user id 'john@example.com', which does not
match the signer's email ('John Doe <john@example.com>')
gpg: DBG: no (of 0) valid bindings. Can't get TOFU validity for this
set of user ids.

As I've seen previously OpenKeychain embeds full User ID as Signer's UID
(that is "John Doe <john@example.com>") but GnuPG users only e-mail
("john@example.com"). It seems when GnuPG encounters Signer's UID in
full form it cannot get TOFU validity.

"Signer's UID" looks like it could contain full UID so maybe GnuPG
should support full User IDs there and just extract the e-mail address?

I don't know if I got the issue right that's why I didn't create a
ticket but if this sounds OK I can do so.

Kind regards,
Wiktor

[0]: https://github.com/open-keychain/open-keychain/issues/2333

--
https://metacode.biz/@wiktor
Re: Trust model tofu+pgp and User ID in Signer's UID packet [ In reply to ]
On Thu, 25 Apr 2019 13:48, gnupg-devel@gnupg.org said:

> As I've seen previously OpenKeychain embeds full User ID as Signer's
> UID (that is "John Doe <john@example.com>") but GnuPG users only

They should not do that becuase only the addrspec identifies the user.
The real name in a mail address is often changed.

> e-mail ("john@example.com"). It seems when GnuPG encounters Signer's
> UID in full form it cannot get TOFU validity.

Right, in gpg the user id from the signature is only sanitized of bad
characters and then used verbatim. Using only the addrspec part, if it
exists, is a better idea. I 'll change that for 2.2.


Salam-Shalom,

Werner

--
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.
Re: Trust model tofu+pgp and User ID in Signer's UID packet [ In reply to ]
Hi,

the attached patch is for master but it should also apply to 2.2. Would
you be so kind and give it a try?

Shalom-Salam,

Werner

--
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.
Re: Trust model tofu+pgp and User ID in Signer's UID packet [ In reply to ]
Hi Werner,

On 03.05.2019 10:57, Werner Koch wrote:
> the attached patch is for master but it should also apply to 2.2. Would
> you be so kind and give it a try?

I did try it on master and yes, it does work.

The message printed changes from (before patch):

gpg: Good signature from "John Doe <john@example.com>" [full]
gpg: WARNING: We do NOT trust this key!
gpg: The signature is probably a FORGERY.

To this (after patching):

gpg: Good signature from "John Doe <john@example.com>" [full]
gpg: john@example.com: Verified 2 signatures in the past 59 minutes.
Encrypted 0 messages.

Thanks for the quick fix!

For the record it seems there is a minor issue when the patch is applied
on 2.2.15 as mailbox_from_userid changed the number of arguments.

Kind regards,
Wiktor

--
https://metacode.biz/@wiktor
Re: Trust model tofu+pgp and User ID in Signer's UID packet [ In reply to ]
On Fri, 3 May 2019 13:20, wiktor@metacode.biz said:

> I did try it on master and yes, it does work.

Thanks for testing.

> For the record it seems there is a minor issue when the patch is
> applied on 2.2.15 as mailbox_from_userid changed the number of
> arguments.

Possible, I didn't tried.


Salam-Shalom,

Werner

--
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.