* (mime-pgp-detect-version): New function.
authoryamaoka <yamaoka>
Mon, 5 Apr 1999 07:19:22 +0000 (07:19 +0000)
committeryamaoka <yamaoka>
Mon, 5 Apr 1999 07:19:22 +0000 (07:19 +0000)
(mime-verify-application/pgp-signature): Use it.
(mime-decrypt-application/pgp-encrypted): Use it.
(TopLevel): Require `std11'.

ChangeLog
mime-pgp.el

index 5d29df8..dd858cb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 1999-04-05  Katsumi Yamaoka   <yamaoka@jpl.org>
 
+       * mime-pgp.el (mime-pgp-detect-version): New function.
+       (mime-verify-application/pgp-signature): Use it.
+       (mime-decrypt-application/pgp-encrypted): Use it.
+       (TopLevel): Require `std11'.
+
        * mime-mc.el (mime-mc-gpg-sign-region): Remove ("--passphrase-fd"
        "0") from the list of arguments.
        (mime-mc-shell-file-name): New user option.
index 88ffcb3..c9a2637 100644 (file)
@@ -44,6 +44,7 @@
 
 ;;; Code:
 
+(require 'std11)
 (require 'semi-def)
 (require 'mime-play)
 
     (set-window-buffer p-win mime-preview-buffer)
     ))
 
+(defun mime-pgp-detect-version (entity)
+  "Detect PGP version from detached signature."
+  (with-temp-buffer
+    (mime-insert-entity-content entity)
+    (std11-narrow-to-header)
+    (let ((version (std11-fetch-field "Version")))
+      (cond ((not version)
+            pgp-version)
+           ((string-match "GnuPG" version)
+            'gpg)
+           ((string-match "5\\.0i" version)
+            'pgp50)
+           ((string-match "2\\.6" version)
+            'pgp)
+           (t
+            pgp-version)))))
+
 
 ;;; @ Internal method for application/pgp-signature
 ;;;
@@ -327,6 +345,7 @@ or \"v\" for choosing a command of PGP 5.0i."
         (basename (expand-file-name "tm" temporary-file-directory))
         (orig-file (make-temp-name basename))
         (sig-file (concat orig-file ".sig"))
+        (pgp-version (mime-pgp-detect-version entity))
         )
     (mime-write-entity orig-entity orig-file)
     (save-excursion (mime-show-echo-buffer))
@@ -397,7 +416,8 @@ or \"v\" for choosing a command of PGP 5.0i."
         (onum (if (> knum 0)
                   (1- knum)
                 (1+ knum)))
-        (orig-entity (nth onum (mime-entity-children mother))))
+        (orig-entity (nth onum (mime-entity-children mother)))
+        (pgp-version (mime-pgp-detect-version orig-entity)))
     (mime-view-application/pgp orig-entity situation)
     ))