Gnus development mailing list
 help / color / mirror / Atom feed
From: Daiki Ueno <ueno@unixuser.org>
Cc: Ding List <ding@gnus.org>,
	 Reiner Steib <reinersteib+gmane@imap.cc>,
	Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Subject: Re: Fwd: [PATCH]: gnus: use correct GPG hash algorithm in 'micalg'
Date: Fri, 05 Aug 2005 18:13:59 +0900	[thread overview]
Message-ID: <82e593ac-30c0-438c-b353-0f053f0ea2d0@well-done.deisui.org> (raw)
In-Reply-To: <ilu64umn471.fsf@latte.josefsson.org> (Simon Josefsson's message of "Wed, 03 Aug 2005 22:41:38 +0200")


[-- Attachment #1.1: Type: text/plain, Size: 834 bytes --]

>>>>> In <ilu64umn471.fsf@latte.josefsson.org> 
>>>>>	Simon Josefsson <jas@extundo.com> wrote:
> Daiki Ueno <ueno@unixuser.org> writes:

> > I'm not sure that the micalg= parameter is still mandatory, while the
> > hash algorithm used is embedded in OpenPGP packets.

> Sadly RFC 1847 require the presence of micalg, it seems.  A wart, but
> difficult to fix at this point.  We should populate it with correct
> information.

> > It can be obtained by using the builtin packet parser (pgg-parse),
> > without depending on --status-fd output of GnuPG.

> Very nice!  Would you mind proposing a patch for mml2016.el that uses
> this approach?

No, I made the patch attached below.

I'm sending this mail with DSA & RIPEMD160.  If the patch works as
expected, micalg=ripemd160 appears in the Content-Type: header.


[-- Attachment #1.2: micalg.diff --]
[-- Type: text/plain, Size: 2442 bytes --]

? micalg.diff
Index: lisp/mml2015.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/mml2015.el,v
retrieving revision 7.9
diff -u -r7.9 mml2015.el
--- lisp/mml2015.el	17 Jul 2005 14:10:38 -0000	7.9
+++ lisp/mml2015.el	5 Aug 2005 07:58:19 -0000
@@ -645,7 +645,8 @@
   (autoload 'pgg-decrypt-region "pgg")
   (autoload 'pgg-verify-region "pgg")
   (autoload 'pgg-sign-region "pgg")
-  (autoload 'pgg-encrypt-region "pgg"))
+  (autoload 'pgg-encrypt-region "pgg")
+  (autoload 'pgg-parse-armor "pgg-parse"))
 
 (defun mml2015-pgg-decrypt (handle ctl)
   (catch 'error
@@ -813,15 +814,23 @@
   (let ((pgg-errors-buffer mml2015-result-buffer)
 	(boundary (mml-compute-boundary cont))
 	(pgg-default-user-id (or (message-options-get 'mml-sender)
-				 pgg-default-user-id)))
+				 pgg-default-user-id))
+	entry)
     (unless (pgg-sign-region (point-min) (point-max))
       (pop-to-buffer mml2015-result-buffer)
       (error "Sign error"))
     (goto-char (point-min))
     (insert (format "Content-Type: multipart/signed; boundary=\"%s\";\n"
 		    boundary))
-      ;;; FIXME: what is the micalg?
-    (insert "\tmicalg=pgp-sha1; protocol=\"application/pgp-signature\"\n")
+    (if (setq entry (assq 2 (pgg-parse-armor
+			     (with-current-buffer pgg-output-buffer
+			       (buffer-string)))))
+	(setq entry (assq 'hash-algorithm (cdr entry))))
+    (insert (format "\tmicalg=%s; "
+		    (if (cdr entry)
+			(downcase (format "pgp-%s" (cdr entry)))
+		      "pgp-sha1")))
+    (insert "protocol=\"application/pgp-signature\"\n")
     (insert (format "\n--%s\n" boundary))
     (goto-char (point-max))
     (insert (format "\n--%s\n" boundary))
Index: lisp/pgg-parse.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/pgg-parse.el,v
retrieving revision 7.6
diff -u -r7.6 pgg-parse.el
--- lisp/pgg-parse.el	5 Jul 2005 22:34:49 -0000	7.6
+++ lisp/pgg-parse.el	5 Aug 2005 07:58:19 -0000
@@ -56,7 +56,8 @@
 	  (cons (sexp :tag "Number") (sexp :tag "Type"))))
 
 (defcustom pgg-parse-hash-algorithm-alist
-  '((1 . MD5) (2 . SHA1) (3 . RIPEMD160) (5 . MD2))
+  '((1 . MD5) (2 . SHA1) (3 . RIPEMD160) (5 . MD2) (8 . SHA256) (9 . SHA384)
+    (10 . SHA512))
   "Alist of the assigned number to the cryptographic hash algorithm."
   :group 'pgg-parse
   :type '(repeat

[-- Attachment #1.3: Type: text/plain, Size: 29 bytes --]


Regards,
-- 
Daiki Ueno

[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]

  reply	other threads:[~2005-08-05  9:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-28 15:02 Fwd: [PATCH]: gnus: use correct GPG hash algorithm in 'micalg' field (was: Broken GPG signatures due to bad 'micalg' value) Reiner Steib
2005-07-29  6:33 ` Fwd: [PATCH]: gnus: use correct GPG hash algorithm in 'micalg' field Daiki Ueno
2005-08-03 20:41   ` Simon Josefsson
2005-08-05  9:13     ` Daiki Ueno [this message]
     [not found]       ` <82e593ac-30c0-438c-b353-0f053f0ea2d0-7dooEoSoPCYjbB9gy5Vrp2D2FQJk+8+b@public.gmane.org>
2005-08-05 11:37         ` Fwd: [PATCH]: gnus: use correct GPG hash algorithm in 'micalg' Jochen Küpper
     [not found]           ` <9ek6j0vcl0.fsf-G2iyDNEOhahHYNAXZw2rCoRsZ6cCL1yJ@public.gmane.org>
2005-08-05 12:05             ` PGP signature and ml software (was: Fwd: [PATCH]: gnus: use correct GPG hash algorithm in 'micalg') Jochen Küpper
2005-08-05 12:55       ` Fwd: [PATCH]: gnus: use correct GPG hash algorithm in 'micalg' field Simon Josefsson
2005-08-05 13:42         ` Reiner Steib
2005-08-08 11:16           ` Simon Josefsson

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=82e593ac-30c0-438c-b353-0f053f0ea2d0@well-done.deisui.org \
    --to=ueno@unixuser.org \
    --cc=ding@gnus.org \
    --cc=enrico.scholz@informatik.tu-chemnitz.de \
    --cc=reinersteib+gmane@imap.cc \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).