2005-08-05 Daiki Ueno <ueno@unixuser.org>
authorSimon Josefsson <jas@extundo.com>
Fri, 5 Aug 2005 11:53:42 +0000 (11:53 +0000)
committerSimon Josefsson <jas@extundo.com>
Fri, 5 Aug 2005 11:53:42 +0000 (11:53 +0000)
* mml2015.el (mml2015-pgg-sign): Make sure micalg is correct.

* pgg-parse.el (pgg-parse-hash-algorithm-alist): Add SHA-2.

lisp/ChangeLog
lisp/mml2015.el
lisp/pgg-parse.el

index f4e86a2..6d0ab4b 100644 (file)
@@ -1,3 +1,9 @@
+2005-08-05  Daiki Ueno <ueno@unixuser.org>
+
+       * mml2015.el (mml2015-pgg-sign): Make sure micalg is correct.
+
+       * pgg-parse.el (pgg-parse-hash-algorithm-alist): Add SHA-2.
+
 2005-08-05  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * mm-bodies.el (mm-encode-body): Use coding system rather than
index d6ff2cb..d4bfa75 100644 (file)
@@ -645,7 +645,8 @@ Valid packages include `pgg', `gpg' and `mailcrypt'.")
   (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 @@ Valid packages include `pgg', `gpg' and `mailcrypt'.")
   (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 bf334b7..b162e06 100644 (file)
@@ -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