From e1157d2698cd6f25e986cbe3563912726faf2471 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Mon, 5 Apr 1999 07:19:22 +0000 Subject: [PATCH] * (mime-pgp-detect-version): New function. (mime-verify-application/pgp-signature): Use it. (mime-decrypt-application/pgp-encrypted): Use it. (TopLevel): Require `std11'. --- ChangeLog | 5 +++++ mime-pgp.el | 22 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5d29df8..dd858cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 1999-04-05 Katsumi Yamaoka + * 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. diff --git a/mime-pgp.el b/mime-pgp.el index 88ffcb3..c9a2637 100644 --- a/mime-pgp.el +++ b/mime-pgp.el @@ -44,6 +44,7 @@ ;;; Code: +(require 'std11) (require 'semi-def) (require 'mime-play) @@ -112,6 +113,23 @@ (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) )) -- 1.7.10.4