[Mew-dist 07125] Re: PGP woes

sen_ml at example.com sen_ml at example.com
1998年 12月 18日 (金) 14:48:41 JST


At around Fri, 18 Dec 1998 11:34:41 +0900,
 Mauro Condarelli <mcondarelli at example.com> may have mentioned:

> Unfortunately a lot of mailers do not use this and simply braket the
> message in:
> 
> -----BEGIN PGP MESSAGE-----
> Version: PGP 5.5.5 -- QDPGP 2.12 
> ...
> ...
> -----END PGP MESSAGE-----
> 
> This is perfectly understandable for pgp, but is not recognized at all 
> by mew :-(

hi-

  i think the authors of mew are working on better support for pgp/gpg --
for the moment, i use the following code to deal w/ non-mime pgp messages.

notes:

  -the code assumes you are using pgp5

  -you can bind the function 'mew-pgp-manual-decrypt' to some key combination
   and invoke it in summary mode to decrypt non-mime pgp messages (of course
   you can invoke the function/command using 'M-x mew-pgp-manual-decrypt'
   as well).

  -there are probably some problems w/ the code -- this is meant as a
   temporary thing

; temp file
(setq mew-temp-file-initial 
      (expand-file-name "~/.pgp/tmp"))

; make mew use pgp5
(setq mew-prog-pgp "pgp5")

(defun mew-pgp-manual-decrypt ()
  ; yet another version
  (interactive)
  ; there might be a better choice than 'default-directory'...
  (setq file2 (expand-file-name 
	       (concat default-directory (mew-summary-message-number))))

  (setq decrypted-file-name 
	(expand-file-name (make-temp-name "~/.pgp/tmp/")))

  ; old stuff starts here
  (message "PGP decrypting ... ")
  (setq mew-pgp-running 'decrypting)
  (setq mew-pgp-string nil)
  (setq mew-pgp-decrypt-msg nil)
  (setq mew-pgp-failure nil)
  (let ((process-connection-type mew-connection-type2)
	file3 process verify)
    
    ; don't want to use /tmp
    ;(setq file3 (mew-make-temp-name))

    ; added this stuff -sln
    (setq file3 decrypted-file-name)

    (setq process (start-process "PGP decrypt"
				 (current-buffer)
				 (mew-pgp-get mew-prog-pgpv)
				 "+language=en" "+batchmode=off"
				 "-o" file3 file2))
    (mew-set-process-cs process mew-cs-autoconv mew-cs-noconv)
    (set-process-filter process 'mew-pgp-process-filter1)
    (set-process-sentinel process 'mew-pgp-process-sentinel)
    ;; Wait for the termination of PGP.
    ;; Emacs doesn't provide synchronize mechanism with
    ;; an asynchronous process. So, take this way. 
    (while mew-pgp-running
	(if mew-xemacs-p
	    (accept-process-output)
	  (sit-for 1)
	  ;; accept-process-output or sleep-for is not enough
	  (discard-input))
	)
    (message "PGP decrypting ... done")
    (save-excursion
      (mew-set-buffer-tmp)
      (insert mew-pgp-string)
      (setq verify (mew-pgp-verify-check))
      )
    (if verify 
	(setq mew-pgp-decrypt-msg (concat mew-pgp-decrypt-msg "\n\t" verify)))
    (list file3 mew-pgp-decrypt-msg)

    ; added this stuff -sln
    ; pop up a new frame w/ decrypted contents
    (switch-to-buffer-other-frame "+decrypted")
    ; put the decrypted results in our new frame
    (insert-file file3)
    ; delete the decrypted file
    (delete-file file3)
    ; place extra results in buffer as well
    (insert mew-pgp-decrypt-msg)
    (insert "\n")
    ))



Mew-dist メーリングリストの案内