all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Teemu Likonen <tlikonen@iki.fi>
To: Daiki Ueno <ueno@gnu.org>
Cc: "Neal H. Walfield" <neal@gnupg.org>, emacs-devel@gnu.org
Subject: Re: epg.el: epg--status-GET_LINE not working?
Date: Wed, 05 Jul 2017 22:03:30 +0300	[thread overview]
Message-ID: <87fueapuyl.fsf@mithlond.arda> (raw)
In-Reply-To: <87d19ec0li.fsf-ueno@gnu.org> (Daiki Ueno's message of "Wed, 05 Jul 2017 18:25:29 +0200")

[-- Attachment #1: Type: text/plain, Size: 3418 bytes --]

Daiki Ueno [2017-07-05 18:25:29+02] wrote:

> Teemu Likonen <tlikonen@iki.fi> writes:
>> I suggest a minimal handler so that epg wouldn't wait GET_LINE input in
>> tofu conflicts (which currently doesn't work anyway) and
>> epg-signature-to-string function would return a string like this:
>>
>>     Good signature from [keyid] [user id] (tofu conflict) created at
>>     [date] using [algorithm]
>>
>> I believe epg is mostly used with Gnus and that line alone is useful.
>
> Would that work?  I mean, if there is an unresolved tofu conflict,
> shouldn't signature verification fail?

Yes and no. There are two different point of views in verification:

 1. Signature is "good" if message's content matches the signature hash
    (message were not altered). Otherwise the signatures is "bad". This
    part can be "good" even if there is a tofu conflict.

 2. The key that made the signature is valid (we trust that it belong to
    the person we think). Gpg returns: TRUST_ULTIMATE, TRUST_FULLY,
    TRUST_MARGINAL etc. If there is a tofu conflict we don't get that
    TRUST_* information at all from gpg.

> Anyway, I would rather ignore "tofu.conflict" like the attached patch
> (not tested), until it becomes really useful.

I agree but with a small addition. That skips the "GET_LINE
tofu.conflict" case (which I think is good) but user is left without any
information about what happened. Function epg-signature-to-string will
return a string like this:

    Good signature from [keyid] [user id] created at
    2017-07-05T21:25:57+0300 using RSA

The signature is good but the usual "(trust ...)" is missing so there is
no information about key's validity. I suggest adding just the tofu
conflict info. With a patch like below the mentioned function would
return:

    Good signature from [keyid] [user id] (trust: tofu-conflict) created
    at 2017-07-05T21:25:57+0300 using RSA


diff --git i/lisp/epg.el w/lisp/epg.el
index c701954b75..80bcea8064 100644
--- i/lisp/epg.el
+++ w/lisp/epg.el
@@ -421,7 +421,7 @@ epg-signature-to-string
 		   (epg-decode-dn user-id)))
        "")
      (if (epg-signature-validity signature)
-	 (format " (trust %s)"  (epg-signature-validity signature))
+	 (format " (trust: %s)"  (epg-signature-validity signature))
        "")
      (if (epg-signature-creation-time signature)
 	 (format-time-string " created at %Y-%m-%dT%T%z"
@@ -905,12 +905,21 @@ epg--status-GET_LINE
   (let ((entry (assoc string epg-prompt-alist))
 	inhibit-quit)
     (condition-case nil
-	(process-send-string (epg-context-process context)
-			     (concat (read-string
-				      (if entry
-					  (cdr entry)
-					(concat string ": ")))
-				     "\n"))
+	(process-send-string
+         (epg-context-process context)
+         (cond ((equal string "tofu.conflict")
+                (let ((signature
+                       (car (epg-context-result-for context 'verify))))
+                  (when (and signature
+                             (eq (epg-signature-status signature) 'good))
+                    (setf (epg-signature-validity signature)
+                          'tofu-conflict))
+                  "\n"))
+               (t (concat (read-string
+                           (if entry
+                               (cdr entry)
+                             (concat string ": ")))
+                          "\n"))))
       (quit
        (epg-context-set-result-for
 	context 'error

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

  reply	other threads:[~2017-07-05 19:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-26  6:58 epg.el: epg--status-GET_LINE not working? Teemu Likonen
2017-06-26  7:30 ` Daiki Ueno
2017-06-26  7:45   ` Teemu Likonen
2017-07-05  5:21   ` Teemu Likonen
2017-07-05 16:25     ` Daiki Ueno
2017-07-05 19:03       ` Teemu Likonen [this message]
2017-07-06 19:42         ` Neal H. Walfield
2017-07-05 23:03       ` Richard Stallman
2017-07-06 19:40       ` Neal H. Walfield
2017-07-06 19:37   ` Neal H. Walfield
2017-07-07  8:37     ` Daiki Ueno
2017-07-07  9:00       ` Neal H. Walfield
2017-07-10  8:31         ` Daiki Ueno
2017-07-10  9:06           ` Neal H. Walfield
2017-07-06 19:29 ` Neal H. Walfield
2017-07-06 20:05   ` Teemu Likonen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fueapuyl.fsf@mithlond.arda \
    --to=tlikonen@iki.fi \
    --cc=emacs-devel@gnu.org \
    --cc=neal@gnupg.org \
    --cc=ueno@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.