:type 'string)
(defcustom pgg-pgp5-shell-file-name "/bin/sh"
- "The GnuPG executable."
+ "File name to load inferior shells from. Bourne shell or its equivalent
+\(not tcsh) is needed for \"2>\"."
+ :group 'pgg-pgp5
+ :type 'string)
+
+(defcustom pgg-pgp5-shell-command-switch "-c"
+ "Switch used to have the shell execute its command line argument."
:group 'pgg-pgp5
:type 'string)
pgg-pgp5-extra-args
(list (concat "2>" errors-file-name))))
(shell-file-name pgg-pgp5-shell-file-name)
+ (shell-command-switch pgg-pgp5-shell-command-switch)
(output-buffer pgg-output-buffer)
(errors-buffer pgg-errors-buffer)
(process-connection-type nil)
(erase-buffer))
(when passphrase
(setenv "PGPPASSFD" "0"))
- (setq process
- (apply #'start-process-shell-command "*PGP*" output-buffer
- program args))
+ (as-binary-process
+ (setq process
+ (apply #'start-process-shell-command "*PGP*" output-buffer
+ program args)))
(set-process-sentinel process 'ignore)
(when passphrase
(process-send-string process (concat passphrase "\n")))
exit-status (process-exit-status process))
(delete-process process)
(with-current-buffer output-buffer
- (goto-char (point-min))
- (while (search-forward "\r$" nil t)
- (replace-match ""))
+ (pgg-convert-lbt-region (point-min)(point-max) 'LF)
+
(if (memq status '(stop signal))
(error "%s exited abnormally: '%s'" program exit-status))
(if (= 127 exit-status)
(luna-define-method lookup-key-string ((scheme pgg-scheme-pgp5)
string &optional type)
(let ((args (list "+language=en" "-l" string)))
- (pgg-pgp5-process-region (point)(point) nil
- pgg-pgp5-pgpk-program args)
- (with-current-buffer pgg-output-buffer
+ (with-current-buffer (get-buffer-create pgg-output-buffer)
+ (buffer-disable-undo)
+ (erase-buffer)
+ (apply #'call-process pgg-pgp5-pgpk-program nil t args)
(goto-char (point-min))
(when (re-search-forward "^sec" nil t)
(substring
(luna-define-method encrypt-region ((scheme pgg-scheme-pgp5)
start end recipients)
(let* ((pgg-pgp5-user-id pgg-default-user-id)
- (passphrase
- (pgg-read-passphrase
- (format "PGP passphrase for %s: " pgg-pgp5-user-id)
- (luna-send scheme 'lookup-key-string
- scheme pgg-pgp5-user-id 'encrypt)))
(args
`("+NoBatchInvalidKeys=off" "-fat" "+batchmode=1"
,@(if recipients
(mapcar (lambda (rcpt)
(list "-r"
(concat "\"" rcpt "\"")))
- recipients))))))
- (pgg-pgp5-process-region start end passphrase
+ (append recipients
+ (if pgg-encrypt-for-me
+ (list pgg-pgp5-user-id)))))))
+ ))
+ (pgg-pgp5-process-region start end nil
pgg-pgp5-pgpe-program args)
- (with-current-buffer pgg-output-buffer
- (if (zerop (buffer-size))
- (insert-buffer-substring pgg-errors-buffer)
- (let ((packet
- (cdr (assq 1 (pgg-parse-armor-region
- (point-min)(point-max))))))
- (pgg-add-passphrase-cache
- (cdr (assq 'key-identifier packet))
- passphrase))))
+ (pgg-process-when-success nil)
))
(luna-define-method decrypt-region ((scheme pgg-scheme-pgp5)
'("+verbose=1" "+batchmode=1" "+language=us" "-f")))
(pgg-pgp5-process-region start end passphrase
pgg-pgp5-pgpv-program args)
- (with-current-buffer pgg-output-buffer
- (when (zerop (buffer-size))
- (insert-buffer-substring pgg-errors-buffer)))
+ (pgg-process-when-success nil)
))
(luna-define-method sign-region ((scheme pgg-scheme-pgp5)
- start end)
+ start end &optional clearsign)
(let* ((pgg-pgp5-user-id pgg-default-user-id)
(passphrase
(pgg-read-passphrase
(luna-send scheme 'lookup-key-string
scheme pgg-pgp5-user-id 'sign)))
(args
- (list "-fbat" "+verbose=1" "+language=us" "+batchmode=1"
+ (list (if clearsign "-fat" "-fbat")
+ "+verbose=1" "+language=us" "+batchmode=1"
"-u" pgg-pgp5-user-id)))
(pgg-pgp5-process-region start end passphrase
pgg-pgp5-pgps-program args)
- (with-current-buffer pgg-output-buffer
- (if (zerop (buffer-size))
- (insert-buffer-substring pgg-errors-buffer)
+ (pgg-process-when-success
+ (when (re-search-forward "^-+BEGIN PGP SIGNATURE" nil t);XXX
(let ((packet
(cdr (assq 2 (pgg-parse-armor-region
- (point-min)(point-max))))))
+ (progn (beginning-of-line 2)
+ (point))
+ (point-max))))))
(pgg-add-passphrase-cache
(cdr (assq 'key-identifier packet))
passphrase))))
(pgg-pgp5-process-region (point-min)(point-max) nil
pgg-pgp5-pgpv-program args)
(delete-file orig-file)
- (delete-file signature)
- (set-buffer pgg-output-buffer)
- (with-current-buffer pgg-output-buffer
- (when (zerop (buffer-size))
- (insert-buffer-substring pgg-errors-buffer)))
+ (if signature (delete-file signature))
+ (pgg-process-when-success nil)
))
(luna-define-method insert-key ((scheme pgg-scheme-pgp5))
(pgg-pgp5-process-region start end nil
pgg-pgp5-pgpk-program args)
(delete-file key-file)
+ (pgg-process-when-success nil)
))
(provide 'pgg-pgp5)