From: Simon Josefsson Date: Sat, 18 Nov 2000 20:57:13 +0000 (+0000) Subject: 2000-11-16 Simon Josefsson X-Git-Url: https://cgit.sxemacs.org/?a=commitdiff_plain;h=2c82cb8b42f0b0189eb09b7063db0461c283e6b0;p=gnus 2000-11-16 Simon Josefsson * gpg.el (gpg-command-verify-cleartext): New variable. (gpg-verify-cleartext): New function. --- diff --git a/contrib/ChangeLog b/contrib/ChangeLog new file mode 100644 index 000000000..b5b3458d4 --- /dev/null +++ b/contrib/ChangeLog @@ -0,0 +1,4 @@ +2000-11-16 Simon Josefsson + + * gpg.el (gpg-command-verify-cleartext): New variable. + (gpg-verify-cleartext): New function. diff --git a/contrib/gpg.el b/contrib/gpg.el index c7b57635f..8f55f32eb 100644 --- a/contrib/gpg.el +++ b/contrib/gpg.el @@ -7,7 +7,7 @@ ;; Keywords: crypto ;; Created: 2000-04-15 -;; $Id: gpg.el,v 6.2 2000/10/31 22:16:42 zsh Exp $ +;; $Id: gpg.el,v 1.1 2000/11/04 12:22:17 zsh Exp $ ;; This file is NOT (yet?) part of GNU Emacs. @@ -304,6 +304,25 @@ charsets or line endings; the input data shall be treated as binary." (string :format "%v")))) :group 'gpg-commands) +(defcustom gpg-command-verify-cleartext + '(gpg . ("--batch" "--verbose" "--verify" message-file)) + "Command to verify a message. +The invoked program has to read the signed message from the given +file. It should write human-readable information to standard output +and/or standard error. The program shall not convert charsets or line +endings; the input data shall be treated as binary." + :tag "Cleartext Verify Command" + :type '(cons + gpg-command-program + (repeat + :tag "Arguments" + (choice + :format "%[Type%] %v" + (const :tag "Insert name of file containing the message here." + :value message-file) + (string :format "%v")))) + :group 'gpg-commands) + (defcustom gpg-command-decrypt '(gpg . ("--decrypt" "--batch" "--passphrase-fd=0")) "Command to decrypt a message. @@ -821,6 +840,39 @@ buffer RESULT for details." nil) t)))) +;;;###autoload +(defun gpg-verify-cleartext (message result) + "Verify message in buffer MESSAGE. +Returns t if everything worked out well, nil otherwise. Consult +buffer RESULT for details. + +NOTE: Use of this function is deprecated." + (interactive "bBuffer containing message: \nbBuffor for result: ") + (gpg-with-temp-files 1 + (let* ((msg-file (nth 0 gpg-temp-files)) + (cmd (gpg-exec-path gpg-command-verify-cleartext)) + (args (gpg-build-arg-list (cdr gpg-command-verify-cleartext) + `((message-file . ,msg-file)))) + res) + (with-temp-file msg-file + (buffer-disable-undo) + (apply 'insert-buffer-substring (if (listp message) + message + (list message)))) + (setq res (apply 'call-process-region + (point-min) (point-min) ; no data + cmd + nil ; don't delete + result + nil ; don't display + args)) + (if (or (stringp res) (> res 0)) + ;; Signal or abnormal exit. + (with-current-buffer result + (insert (format "\nCommand exit status: %s\n" res)) + nil) + t)))) + ;;;###autoload (defun gpg-decrypt (ciphertext plaintext result &optional passphrase) "Decrypt buffer CIPHERTEXT to buffer PLAINTEXT.