From bb17f0a3b1b88e30ed4c5646b3714bad4aebadff Mon Sep 17 00:00:00 2001 From: hayashi Date: Tue, 8 Feb 2000 06:53:13 +0000 Subject: [PATCH] Fix doc string --- ChangeLog | 42 ++++++++++++++++----------- mime-pgp.el | 2 +- pgg-def.el | 14 +++++---- pgg-gpg.el | 56 ++++++++++++++++++------------------ pgg-parse.el | 91 ++++++++++++++++++++++++++-------------------------------- pgg-pgp.el | 52 ++++++++++++++++----------------- pgg-pgp5.el | 66 +++++++++++++++++++++--------------------- pgg.el | 16 +++++------ 8 files changed, 170 insertions(+), 169 deletions(-) diff --git a/ChangeLog b/ChangeLog index cd1d9e6..3d6cd0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2000-02-07 Yoshiki Hayashi + + * mime-pgp.el: Fix doc string. + * pgg-def.el: Ditto. + * pgg-gpg.el: Ditto. + * pgg-parse.el: Ditto. + * pgg-pgp.el: Ditto. + * pgg-pgp5.el: Ditto. + * pgg.el: Ditto. + 2000-02-02 Daiki Ueno * pgg.el (pgg-temp-buffer-show-function): Don't check if the @@ -754,7 +764,7 @@ 1999-08-18 MORIOKA Tomohiko - * REMI: Version 1.13.2 (-DÒike-Ikoinomori)-A released. + * REMI: Version 1.13.2 (-DRike-Ikoinomori) released. 1999-08-17 Katsumi Yamaoka @@ -825,7 +835,7 @@ 1999-07-27 MORIOKA Tomohiko - * SEMI: Version 1.13.5 (Meih-Dò)-A released. + * SEMI: Version 1.13.5 (Meih-Dr) released. 1999-07-27 MORIOKA Tomohiko @@ -1128,7 +1138,7 @@ 1999-01-21 MORIOKA Tomohiko - * SEMI: Version 1.13.0 (Matt-Dò)-A released. + * SEMI: Version 1.13.0 (Matt-Dr) released. 1999-01-21 MORIOKA Tomohiko @@ -1626,7 +1636,7 @@ 1998-07-08 MORIOKA Tomohiko - * REMI: Version 1.8.3 (Ecch-Dþ-Nakagawa)-A released. + * REMI: Version 1.8.3 (Ecch-D~-Nakagawa) released. * mime-play.el (mime-delq-null-situation): Add new optional argument `ignored-value'. @@ -1655,7 +1665,7 @@ 1998-07-08 MORIOKA Tomohiko - * REMI: Version 1.8.2 (N-Dòmachi)-A released. + * REMI: Version 1.8.2 (N-Drmachi) released. 1998-07-07 MORIOKA Tomohiko @@ -1774,7 +1784,7 @@ 1998-06-28 MORIOKA Tomohiko - * REMI: Version 1.8.0 (Ecch-Dþ-Kokubu)-A released. + * REMI: Version 1.8.0 (Ecch-D~-Kokubu) released. 1998-06-26 MORIOKA Tomohiko @@ -2610,7 +2620,7 @@ 1998-06-04 MORIOKA Tomohiko - * SEMI: Version 1.5.0 (Nishi-Ny-Dþzen)-A released. + * SEMI: Version 1.5.0 (Nishi-Ny-D~zen) released. * README.en (Required environment): Modify for FLIM 1.3.0. @@ -2662,7 +2672,7 @@ 1998-06-01 MORIOKA Tomohiko - * SEMI: Version 1.4.6 (Ny-Dþzen)-A released. + * SEMI: Version 1.4.6 (Ny-D~zen) released. 1998-05-28 MORIOKA Tomohiko @@ -2875,7 +2885,7 @@ 1998-05-15 MORIOKA Tomohiko - * SEMI: Version 1.4.4 (Ecch-Dþ-Miyazaki)-A released. + * SEMI: Version 1.4.4 (Ecch-D~-Miyazaki) released. * mime-play.el (mime-mailcap-method-filename-alist): New variable. (mime-mailcap-method-sentinel): New function. @@ -3001,7 +3011,7 @@ 1998-05-06 MORIOKA Tomohiko - * SEMI: Version 1.4.1 (-DÒmi)-A released. + * SEMI: Version 1.4.1 (-DRmi) released. * README.en (Required environment): Modify for FLIM 1.2.0. @@ -3161,7 +3171,7 @@ 1998-04-25 MORIOKA Tomohiko - * SEMI: Version 1.3.2 (N-Dò)-A was released. + * SEMI: Version 1.3.2 (N-Dr) was released. * mime-edit.el (mime-edit-mode-entity-prefix): New variable. (mime-edit-mode-entity-map): New variable. @@ -3816,7 +3826,7 @@ 1998-03-13 MORIOKA Tomohiko - * SEMI: Version 1.0.2 (Nonoichi-K-Dòdaimae)-A was released. + * SEMI: Version 1.0.2 (Nonoichi-K-Drdaimae) was released. 1998-03-12 MORIOKA Tomohiko @@ -3899,7 +3909,7 @@ * mime-file.el: Rename `mime-article/extract-file' -> `mime-extract-current-entity'. -1998-03-03 François Pinard +1998-03-03 Fran-Agois Pinard * mime-edit.el (mime-edit-insert-signature): Function `mime-edit-insert-tag' is sometimes called with more arguments @@ -3928,7 +3938,7 @@ 1998-02-25 MORIOKA Tomohiko - * SEMI: Version 1.0.0 (Nukaj-Dþtaku-mae)-A was released. + * SEMI: Version 1.0.0 (Nukaj-D~taku-mae) was released. * SEMI-ELS: Remove mime-tar.el. @@ -4065,14 +4075,14 @@ 1997-11-16 MORIOKA Tomohiko - * SEMI: Version 0.116 (D-Dòhòji)-A was released. + * SEMI: Version 0.116 (D-Drhrji) was released. 1997-11-15 MORIOKA Tomohiko * mime-view.el, mime-pgp.el, mime-partial.el: Rename `mime::article/content-info' -> `mime-raw-content-info'. -1997-11-11 François Pinard +1997-11-11 Fran-Agois Pinard * mime-edit.el: Modify space in prompt and removespurious trailing spaces in the files. (cf. [tm-en:1507]) diff --git a/mime-pgp.el b/mime-pgp.el index 7012859..7bfdb61 100644 --- a/mime-pgp.el +++ b/mime-pgp.el @@ -1,4 +1,4 @@ -;;; mime-pgp.el --- mime-view internal methods foro PGP. +;;; mime-pgp.el --- mime-view internal methods for PGP. ;; Copyright (C) 1995,1996,1997,1998,1999 MORIOKA Tomohiko diff --git a/pgg-def.el b/pgg-def.el index c8fef62..1227996 100644 --- a/pgg-def.el +++ b/pgg-def.el @@ -32,9 +32,11 @@ :group 'mime) (defcustom pgg-default-scheme 'gpg - "Default PGP scheme" - :group 'symbol - :type 'string) + "Default PGP scheme." + :group 'pgg + :type '(choice (const :tag "GnuPG" gpg) + (const :tag "PGP 5" pgp5) + (const :tag "PGP" pgp))) (defcustom pgg-default-user-id (user-login-name) "User ID of your default identity." @@ -47,12 +49,12 @@ :type 'string) (defcustom pgg-encrypt-for-me nil - "Encrypt all outgoing messages with user's public key." + "If t, encrypt all outgoing messages with user's public key." :group 'pgg :type 'boolean) (defcustom pgg-cache-passphrase t - "Cache passphrase" + "If t, cache passphrase." :group 'pgg :type 'boolean) @@ -63,7 +65,7 @@ (defvar pgg-echo-buffer "*PGG-echo*") (defvar pgg-scheme nil - "Current scheme of PGP implementation") + "Current scheme of PGP implementation.") (defmacro pgg-truncate-key-identifier (key) `(if (> (length ,key) 8) (substring ,key 8) ,key)) diff --git a/pgg-gpg.el b/pgg-gpg.el index 2bcb3c7..aa4b50c 100644 --- a/pgg-gpg.el +++ b/pgg-gpg.el @@ -37,8 +37,8 @@ :type 'string) (defcustom pgg-gpg-shell-file-name "/bin/sh" - "File name to load inferior shells from. Bourne shell or its equivalent -\(not tcsh) is needed for \"2>\"." + "File name to load inferior shells from. +Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." :group 'pgg-gpg :type 'string) @@ -68,12 +68,12 @@ (defun pgg-gpg-process-region (start end passphrase program args) (let* ((errors-file-name - (concat temporary-file-directory + (concat temporary-file-directory (make-temp-name "pgg-errors"))) (status-file-name - (concat temporary-file-directory + (concat temporary-file-directory (make-temp-name "pgg-status"))) - (args + (args (append `("--status-fd" "3" ,@(if passphrase '("--passphrase-fd" "0")) @@ -130,7 +130,7 @@ (luna-define-method pgg-scheme-lookup-key ((scheme pgg-scheme-gpg) string &optional type) - (let ((args (list "--with-colons" "--no-greeting" "--batch" + (let ((args (list "--with-colons" "--no-greeting" "--batch" (if type "--list-secret-keys" "--list-keys") string))) (with-current-buffer (get-buffer-create pgg-output-buffer) @@ -139,23 +139,23 @@ (apply #'call-process pgg-gpg-program nil t nil args) (goto-char (point-min)) (when (re-search-forward "^\\(sec\\|pub\\):" nil t) - (substring - (nth 3 (split-string + (substring + (nth 3 (split-string (buffer-substring (match-end 0) (progn (end-of-line)(point))) ":")) 8))))) -(luna-define-method pgg-scheme-encrypt-region ((scheme pgg-scheme-gpg) +(luna-define-method pgg-scheme-encrypt-region ((scheme pgg-scheme-gpg) start end recipients) (let* ((pgg-gpg-user-id (or pgg-gpg-user-id pgg-default-user-id)) - (args + (args `("--batch" "--armor" "--always-trust" "--encrypt" ,@(if recipients - (apply #'append - (mapcar (lambda (rcpt) - (list "--remote-user" - (concat "\"" rcpt "\""))) + (apply #'append + (mapcar (lambda (rcpt) + (list "--remote-user" + (concat "\"" rcpt "\""))) (append recipients (if pgg-encrypt-for-me (list pgg-gpg-user-id))))))))) @@ -164,27 +164,27 @@ (pgg-process-when-success (pgg-convert-lbt-region (point-min)(point-max) 'LF)))) -(luna-define-method pgg-scheme-decrypt-region ((scheme pgg-scheme-gpg) +(luna-define-method pgg-scheme-decrypt-region ((scheme pgg-scheme-gpg) start end) (let* ((pgg-gpg-user-id (or pgg-gpg-user-id pgg-default-user-id)) (passphrase - (pgg-read-passphrase + (pgg-read-passphrase (format "GnuPG passphrase for %s: " pgg-gpg-user-id) (pgg-scheme-lookup-key scheme pgg-gpg-user-id 'encrypt))) (args '("--batch" "--decrypt"))) (pgg-gpg-process-region start end passphrase pgg-gpg-program args) (pgg-process-when-success nil))) -(luna-define-method pgg-scheme-sign-region ((scheme pgg-scheme-gpg) +(luna-define-method pgg-scheme-sign-region ((scheme pgg-scheme-gpg) start end &optional cleartext) (let* ((pgg-gpg-user-id (or pgg-gpg-user-id pgg-default-user-id)) (passphrase - (pgg-read-passphrase + (pgg-read-passphrase (format "GnuPG passphrase for %s: " pgg-gpg-user-id) (pgg-scheme-lookup-key scheme pgg-gpg-user-id 'sign))) - (args + (args (list (if cleartext "--clearsign" "--detach-sign") - "--armor" "--batch" "--verbose" + "--armor" "--batch" "--verbose" "--local-user" pgg-gpg-user-id)) (inhibit-read-only t) buffer-read-only) @@ -193,17 +193,17 @@ (pgg-process-when-success (pgg-convert-lbt-region (point-min)(point-max) 'LF) (when (re-search-forward "^-+BEGIN PGP SIGNATURE" nil t);XXX - (let ((packet - (cdr (assq 2 (pgg-parse-armor-region + (let ((packet + (cdr (assq 2 (pgg-parse-armor-region (progn (beginning-of-line 2) (point)) (point-max)))))) (if pgg-cache-passphrase - (pgg-add-passphrase-cache + (pgg-add-passphrase-cache (cdr (assq 'key-identifier packet)) passphrase))))))) -(luna-define-method pgg-scheme-verify-region ((scheme pgg-scheme-gpg) +(luna-define-method pgg-scheme-verify-region ((scheme pgg-scheme-gpg) start end &optional signature) (let ((args '("--batch" "--verify"))) (when (stringp signature) @@ -230,7 +230,7 @@ (luna-define-method pgg-scheme-insert-key ((scheme pgg-scheme-gpg)) (let* ((pgg-gpg-user-id (or pgg-gpg-user-id pgg-default-user-id)) - (args (list "--batch" "--export" "--armor" + (args (list "--batch" "--export" "--armor" (concat "\"" pgg-gpg-user-id "\"")))) (pgg-gpg-process-region (point)(point) nil pgg-gpg-program args) (insert-buffer-substring pgg-output-buffer))) @@ -242,10 +242,10 @@ (set-buffer pgg-status-buffer) (goto-char (point-min)) (when (re-search-forward "^\\[GNUPG:] +IMPORT_RES +" nil t) - (setq status (buffer-substring (match-end 0) - (progn (end-of-line) + (setq status (buffer-substring (match-end 0) + (progn (end-of-line) (point))) - status (vconcat (mapcar #'string-to-int + status (vconcat (mapcar #'string-to-int (split-string status)))) (erase-buffer) (insert (format "Imported %d key(s). diff --git a/pgg-parse.el b/pgg-parse.el index 040ae1a..910b0ff 100644 --- a/pgg-parse.el +++ b/pgg-parse.el @@ -28,7 +28,7 @@ ;; This module is based on ;; [OpenPGP] RFC 2440: "OpenPGP Message Format" -;; by John W. Noerenberg, II , +;; by John W. Noerenberg, II , ;; Jon Callas , Lutz Donnerhacke , ;; Hal Finney and Rodney Thayer ;; (1998/11) @@ -72,7 +72,7 @@ (2 . ZLIB)) "Alist of the assigned number to the compression algorithm." :group 'pgg-parse - :type 'alist) + :type 'alist) (defcustom pgg-parse-signature-type-alist '((0 . "Signature of a binary document") @@ -81,7 +81,7 @@ (16 . "Generic certification of a User ID and Public Key packet") (17 . "Persona certification of a User ID and Public Key packet") (18 . "Casual certification of a User ID and Public Key packet") - (19 . "Positive certification of a User ID and Public Key packet") + (19 . "Positive certification of a User ID and Public Key packet") (24 . "Subkey Binding Signature") (31 . "Signature directly on a key") (32 . "Key revocation signature") @@ -102,7 +102,7 @@ "^-----BEGIN PGP PUBLIC KEY BLOCK-----\r?$" "^-----BEGIN PGP PRIVATE KEY BLOCK-----\r?$" "^-----BEGIN PGP SIGNATURE-----\r?$") - "Armor headers") + "Armor headers.") (defmacro pgg-format-key-identifier (string) `(upcase (apply #'format "%02x%02x%02x%02x%02x%02x%02x%02x" @@ -122,7 +122,7 @@ `(char-int (char-after (prog1 (point) (forward-char))))) (defmacro pgg-read-bytes-string (nbytes) - `(buffer-substring + `(buffer-substring (point) (prog1 (+ ,nbytes (point)) (forward-char ,nbytes)))) @@ -171,14 +171,13 @@ (format "%c%c%c" (logand (aref h 1) 255) (logand (lsh (aref h 2) -8) 255) - (logand (aref h 2) 255)))) - ) + (logand (aref h 2) 255))))) (defmacro pgg-parse-length-type (c) - `(cond + `(cond ((< ,c 192) (cons ,c 1)) ((< ,c 224) - (cons (+ (lsh (- ,c 192) 8) + (cons (+ (lsh (- ,c 192) 8) (pgg-byte-after (+ 2 (point))) 192) 2)) @@ -202,12 +201,11 @@ packet-bytes 0 header-bytes (1+ length-type)) (dotimes (i length-type) - (setq packet-bytes - (logior (lsh packet-bytes 8) - (pgg-byte-after (+ 1 i (point)))))) - ) + (setq packet-bytes + (logior (lsh packet-bytes 8) + (pgg-byte-after (+ 1 i (point))))))) (setq content-tag (logand 63 ptag) - length-type (pgg-parse-length-type + length-type (pgg-parse-length-type (pgg-byte-after (1+ (point)))) packet-bytes (car length-type) header-bytes (1+ (cdr length-type)))) @@ -236,23 +234,23 @@ ;; 12 -- Trust Packet (13 ;User ID Packet (pgg-read-body-string ptag)) - ;; 14 -- Public Subkey Packet + ;; 14 -- Public Subkey Packet ;; 60 .. 63 -- Private or Experimental Values )) (defun pgg-parse-packets (&optional header-parser body-parser) (let ((header-parser - (or header-parser + (or header-parser (function pgg-parse-packet-header))) (body-parser - (or body-parser + (or body-parser (function pgg-parse-packet))) result ptag) (while (> (point-max) (1+ (point))) (setq ptag (funcall header-parser)) (pgg-skip-header ptag) - (push (cons (car ptag) - (save-excursion + (push (cons (car ptag) + (save-excursion (funcall body-parser ptag))) result) (if (zerop (nth 1 ptag)) @@ -269,11 +267,11 @@ (defun pgg-parse-signature-subpacket (ptag) (case (car ptag) (2 ;signature creation time - (cons 'creation-time + (cons 'creation-time (let ((bytes (pgg-read-bytes 4))) (pgg-parse-time-field bytes)))) (3 ;signature expiration time - (cons 'signature-expiry + (cons 'signature-expiry (let ((bytes (pgg-read-bytes 4))) (pgg-parse-time-field bytes)))) (4 ;exportable certification @@ -281,12 +279,12 @@ (5 ;trust signature (cons 'trust-level (pgg-read-byte))) (6 ;regular expression - (cons 'regular-expression + (cons 'regular-expression (pgg-read-body-string ptag))) (7 ;revocable (cons 'revocability (pgg-read-byte))) (9 ;key expiration time - (cons 'key-expiry + (cons 'key-expiry (let ((bytes (pgg-read-bytes 4))) (pgg-parse-time-field bytes)))) ;; 10 = placeholder for backward compatibility @@ -304,13 +302,12 @@ (cons 'notation (let ((name-bytes (pgg-read-bytes 2)) (value-bytes (pgg-read-bytes 2))) - (cons (pgg-read-bytes-string + (cons (pgg-read-bytes-string (logior (lsh (car name-bytes) 8) (nth 1 name-bytes))) - (pgg-read-bytes-string + (pgg-read-bytes-string (logior (lsh (car value-bytes) 8) - (nth 1 value-bytes)))))) - ) + (nth 1 value-bytes))))))) (21 ;preferred hash algorithms (cons 'preferred-hash-algorithm (cdr (assq (pgg-read-byte) @@ -338,16 +335,16 @@ (let* ((signature-version (pgg-byte-after)) (result (list (cons 'version signature-version))) hashed-material field n) - (cond + (cond ((= signature-version 3) (pgg-skip-bytes 2) (setq hashed-material (pgg-read-bytes 5)) - (pgg-set-alist result - 'signature-type + (pgg-set-alist result + 'signature-type (cdr (assq (pop hashed-material) pgg-parse-signature-type-alist))) (pgg-set-alist result - 'creation-time + 'creation-time (pgg-parse-time-field hashed-material)) (pgg-set-alist result 'key-identifier @@ -356,16 +353,15 @@ (pgg-set-alist result 'public-key-algorithm (pgg-read-byte)) (pgg-set-alist result - 'hash-algorithm (pgg-read-byte)) - ) + 'hash-algorithm (pgg-read-byte))) ((= signature-version 4) (pgg-skip-bytes 1) (pgg-set-alist result - 'signature-type + 'signature-type (cdr (assq (pgg-read-byte) pgg-parse-signature-type-alist))) (pgg-set-alist result - 'public-key-algorithm + 'public-key-algorithm (pgg-read-byte)) (pgg-set-alist result 'hash-algorithm (pgg-read-byte)) @@ -376,11 +372,10 @@ (narrow-to-region (point)(+ n (point))) (nconc result (mapcar (function cdr) ;remove packet types - (pgg-parse-packets + (pgg-parse-packets #'pgg-parse-signature-subpacket-header #'pgg-parse-signature-subpacket))) - (goto-char (point-max))) - ) + (goto-char (point-max)))) (when (>= 10000 (setq n (pgg-read-bytes 2) n (logior (lsh (car n) 8) (nth 1 n)))) @@ -388,11 +383,9 @@ (narrow-to-region (point)(+ n (point))) (nconc result (mapcar (function cdr) ;remove packet types - (pgg-parse-packets + (pgg-parse-packets #'pgg-parse-signature-subpacket-header - #'pgg-parse-signature-subpacket))) - )) - )) + #'pgg-parse-signature-subpacket))))))) (setcdr (setq field (assq 'public-key-algorithm result)) @@ -410,7 +403,7 @@ 'version (pgg-read-byte)) (pgg-set-alist result 'key-identifier - (pgg-format-key-identifier + (pgg-format-key-identifier (pgg-read-bytes-string 8))) (pgg-set-alist result 'public-key-algorithm @@ -442,16 +435,14 @@ (pgg-set-alist result 'key-expiry (pgg-read-bytes 2)) (pgg-set-alist result - 'public-key-algorithm (pgg-read-byte)) - ) + 'public-key-algorithm (pgg-read-byte))) ((= 4 key-version) (pgg-set-alist result 'creation-time (let ((bytes (pgg-read-bytes 4))) (pgg-parse-time-field bytes))) (pgg-set-alist result - 'public-key-algorithm (pgg-read-byte)) - )) + 'public-key-algorithm (pgg-read-byte)))) (setcdr (setq field (assq 'public-key-algorithm result)) @@ -469,12 +460,12 @@ (mime-decode-region (point-min) marker "base64") (static-when (fboundp 'pgg-parse-crc24-string ) (or pgg-ignore-packet-checksum - (string-equal + (string-equal (funcall (mel-find-function 'mime-encode-string "base64") - (pgg-parse-crc24-string + (pgg-parse-crc24-string (buffer-substring (point-min)(point-max)))) checksum) - (error "PGP packet checksum does not match."))))) + (error "PGP packet checksum does not match"))))) (defun pgg-decode-armor-region (start end) (save-restriction diff --git a/pgg-pgp.el b/pgg-pgp.el index e7e2ee7..f407bde 100644 --- a/pgg-pgp.el +++ b/pgg-pgp.el @@ -31,14 +31,14 @@ "PGP 2.* and 6.* interface" :group 'pgg) -(defcustom pgg-pgp-program "pgp" +(defcustom pgg-pgp-program "pgp" "PGP 2.* and 6.* executable." :group 'pgg-pgp :type 'string) (defcustom pgg-pgp-shell-file-name "/bin/sh" - "File name to load inferior shells from. Bourne shell or its equivalent -\(not tcsh) is needed for \"2>\"." + "File name to load inferior shells from. +Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." :group 'pgg-pgp :type 'string) @@ -56,7 +56,7 @@ (luna-define-class pgg-scheme-pgp (pgg-scheme))) (defvar pgg-pgp-user-id nil - "GnuPG ID of your default identity.") + "PGP ID of your default identity.") (defvar pgg-scheme-pgp-instance nil) @@ -68,10 +68,10 @@ (defun pgg-pgp-process-region (start end passphrase program args) (let* ((errors-file-name - (concat temporary-file-directory + (concat temporary-file-directory (make-temp-name "pgg-errors"))) - (args - (append args + (args + (append args pgg-pgp-extra-args (list (concat "2>" errors-file-name)))) (shell-file-name pgg-pgp-shell-file-name) @@ -116,7 +116,7 @@ (if (and process (eq 'run (process-status process))) (interrupt-process process))))) -(luna-define-method pgg-scheme-lookup-key ((scheme pgg-scheme-pgp) +(luna-define-method pgg-scheme-lookup-key ((scheme pgg-scheme-pgp) string &optional type) (let ((args (list "+batchmode" "+language=en" "-kv" string))) (with-current-buffer (get-buffer-create pgg-output-buffer) @@ -129,15 +129,15 @@ (buffer-substring (point)(+ 8 (point)))) ((re-search-forward "^Type" nil t);PGP 6.* (beginning-of-line 2) - (substring - (nth 2 (split-string + (substring + (nth 2 (split-string (buffer-substring (point)(progn (end-of-line) (point))))) 2)))))) -(luna-define-method pgg-scheme-encrypt-region ((scheme pgg-scheme-pgp) +(luna-define-method pgg-scheme-encrypt-region ((scheme pgg-scheme-pgp) start end recipients) (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) - (args + (args `("+encrypttoself=off +verbose=1" "+batchmode" "+language=us" "-fate" ,@(if recipients @@ -148,26 +148,26 @@ (pgg-pgp-process-region start end nil pgg-pgp-program args) (pgg-process-when-success nil))) -(luna-define-method pgg-scheme-decrypt-region ((scheme pgg-scheme-pgp) +(luna-define-method pgg-scheme-decrypt-region ((scheme pgg-scheme-pgp) start end) (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) (passphrase - (pgg-read-passphrase + (pgg-read-passphrase (format "PGP passphrase for %s: " pgg-pgp-user-id) (pgg-scheme-lookup-key scheme pgg-pgp-user-id 'encrypt))) - (args + (args '("+verbose=1" "+batchmode" "+language=us" "-f"))) (pgg-pgp-process-region start end passphrase pgg-pgp-program args) (pgg-process-when-success nil))) -(luna-define-method pgg-scheme-sign-region ((scheme pgg-scheme-pgp) +(luna-define-method pgg-scheme-sign-region ((scheme pgg-scheme-pgp) start end &optional clearsign) (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) (passphrase - (pgg-read-passphrase + (pgg-read-passphrase (format "PGP passphrase for %s: " pgg-pgp-user-id) (pgg-scheme-lookup-key scheme pgg-pgp-user-id 'sign))) - (args + (args (list (if clearsign "-fast" "-fbast") "+verbose=1" "+language=us" "+batchmode" "-u" pgg-pgp-user-id))) @@ -175,17 +175,17 @@ (pgg-process-when-success (goto-char (point-min)) (when (re-search-forward "^-+BEGIN PGP" nil t);XXX - (let ((packet - (cdr (assq 2 (pgg-parse-armor-region + (let ((packet + (cdr (assq 2 (pgg-parse-armor-region (progn (beginning-of-line 2) (point)) (point-max)))))) (if pgg-cache-passphrase - (pgg-add-passphrase-cache + (pgg-add-passphrase-cache (cdr (assq 'key-identifier packet)) passphrase))))))) -(luna-define-method pgg-scheme-verify-region ((scheme pgg-scheme-pgp) +(luna-define-method pgg-scheme-verify-region ((scheme pgg-scheme-pgp) start end &optional signature) (let* ((basename (expand-file-name "pgg" temporary-file-directory)) (orig-file (make-temp-name basename)) @@ -210,14 +210,14 @@ (progn (beginning-of-line 2) (point))))) (goto-char (point-min)) (when (re-search-forward "^\\.$" nil t) - (delete-region (point-min) + (delete-region (point-min) (progn (beginning-of-line 2) (point))))))) (luna-define-method pgg-scheme-insert-key ((scheme pgg-scheme-pgp)) (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) (args - (list "+verbose=1" "+batchmode" "+language=us" "-kxaf" + (list "+verbose=1" "+batchmode" "+language=us" "-kxaf" (concat "\"" pgg-pgp-user-id "\"")))) (pgg-pgp-process-region (point)(point) nil pgg-pgp-program args) (insert-buffer-substring pgg-output-buffer))) @@ -227,8 +227,8 @@ (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) (basename (expand-file-name "pgg" temporary-file-directory)) (key-file (make-temp-name basename)) - (args - (list "+verbose=1" "+batchmode" "+language=us" "-kaf" + (args + (list "+verbose=1" "+batchmode" "+language=us" "-kaf" key-file))) (write-region-as-raw-text-CRLF start end key-file) (pgg-pgp-process-region start end nil pgg-pgp-program args) diff --git a/pgg-pgp5.el b/pgg-pgp5.el index 2b26a3f..b683d96 100644 --- a/pgg-pgp5.el +++ b/pgg-pgp5.el @@ -31,29 +31,29 @@ "PGP 5.* interface" :group 'pgg) -(defcustom pgg-pgp5-pgpe-program "pgpe" +(defcustom pgg-pgp5-pgpe-program "pgpe" "PGP 5.* 'pgpe' executable." :group 'pgg-pgp5 :type 'string) -(defcustom pgg-pgp5-pgps-program "pgps" +(defcustom pgg-pgp5-pgps-program "pgps" "PGP 5.* 'pgps' executable." :group 'pgg-pgp5 :type 'string) -(defcustom pgg-pgp5-pgpk-program "pgpk" +(defcustom pgg-pgp5-pgpk-program "pgpk" "PGP 5.* 'pgpk' executable." :group 'pgg-pgp5 :type 'string) -(defcustom pgg-pgp5-pgpv-program "pgpv" +(defcustom pgg-pgp5-pgpv-program "pgpv" "PGP 5.* 'pgpv' executable." :group 'pgg-pgp5 :type 'string) (defcustom pgg-pgp5-shell-file-name "/bin/sh" - "File name to load inferior shells from. Bourne shell or its equivalent -\(not tcsh) is needed for \"2>\"." + "File name to load inferior shells from. +Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." :group 'pgg-pgp5 :type 'string) @@ -63,7 +63,7 @@ :type 'string) (defcustom pgg-pgp5-extra-args nil - "Extra arguments for every PGP invocation." + "Extra arguments for every PGP 5.* invocation." :group 'pgg-pgp5 :type 'string) @@ -71,7 +71,7 @@ (luna-define-class pgg-scheme-pgp5 (pgg-scheme))) (defvar pgg-pgp5-user-id nil - "GnuPG ID of your default identity.") + "PGP 5.* ID of your default identity.") (defvar pgg-scheme-pgp5-instance nil) @@ -83,10 +83,10 @@ (defun pgg-pgp5-process-region (start end passphrase program args) (let* ((errors-file-name - (concat temporary-file-directory + (concat temporary-file-directory (make-temp-name "pgg-errors"))) - (args - (append args + (args + (append args pgg-pgp5-extra-args (list (concat "2>" errors-file-name)))) (shell-file-name pgg-pgp5-shell-file-name) @@ -131,7 +131,7 @@ (if (and process (eq 'run (process-status process))) (interrupt-process process))))) -(luna-define-method pgg-scheme-lookup-key ((scheme pgg-scheme-pgp5) +(luna-define-method pgg-scheme-lookup-key ((scheme pgg-scheme-pgp5) string &optional type) (let ((args (list "+language=en" "-l" string))) (with-current-buffer (get-buffer-create pgg-output-buffer) @@ -140,64 +140,64 @@ (apply #'call-process pgg-pgp5-pgpk-program nil t nil args) (goto-char (point-min)) (when (re-search-forward "^sec" nil t) - (substring - (nth 2 (split-string + (substring + (nth 2 (split-string (buffer-substring (match-end 0)(progn (end-of-line)(point))))) 2))))) -(luna-define-method pgg-scheme-encrypt-region ((scheme pgg-scheme-pgp5) +(luna-define-method pgg-scheme-encrypt-region ((scheme pgg-scheme-pgp5) start end recipients) (let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id)) - (args + (args `("+NoBatchInvalidKeys=off" "-fat" "+batchmode=1" ,@(if recipients - (apply #'append - (mapcar (lambda (rcpt) - (list "-r" - (concat "\"" rcpt "\""))) + (apply #'append + (mapcar (lambda (rcpt) + (list "-r" + (concat "\"" rcpt "\""))) (append recipients (if pgg-encrypt-for-me (list pgg-pgp5-user-id))))))))) (pgg-pgp5-process-region start end nil pgg-pgp5-pgpe-program args) (pgg-process-when-success nil))) -(luna-define-method pgg-scheme-decrypt-region ((scheme pgg-scheme-pgp5) +(luna-define-method pgg-scheme-decrypt-region ((scheme pgg-scheme-pgp5) start end) (let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id)) (passphrase - (pgg-read-passphrase + (pgg-read-passphrase (format "PGP passphrase for %s: " pgg-pgp5-user-id) (pgg-scheme-lookup-key scheme pgg-pgp5-user-id 'encrypt))) - (args + (args '("+verbose=1" "+batchmode=1" "+language=us" "-f"))) (pgg-pgp5-process-region start end passphrase pgg-pgp5-pgpv-program args) (pgg-process-when-success nil))) -(luna-define-method pgg-scheme-sign-region ((scheme pgg-scheme-pgp5) +(luna-define-method pgg-scheme-sign-region ((scheme pgg-scheme-pgp5) start end &optional clearsign) (let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id)) (passphrase - (pgg-read-passphrase + (pgg-read-passphrase (format "PGP passphrase for %s: " pgg-pgp5-user-id) (pgg-scheme-lookup-key scheme pgg-pgp5-user-id 'sign))) - (args + (args (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) (pgg-process-when-success (when (re-search-forward "^-+BEGIN PGP SIGNATURE" nil t);XXX - (let ((packet - (cdr (assq 2 (pgg-parse-armor-region + (let ((packet + (cdr (assq 2 (pgg-parse-armor-region (progn (beginning-of-line 2) (point)) (point-max)))))) (if pgg-cache-passphrase - (pgg-add-passphrase-cache + (pgg-add-passphrase-cache (cdr (assq 'key-identifier packet)) passphrase))))))) -(luna-define-method pgg-scheme-verify-region ((scheme pgg-scheme-pgp5) +(luna-define-method pgg-scheme-verify-region ((scheme pgg-scheme-pgp5) start end &optional signature) (let* ((basename (expand-file-name "pgg" temporary-file-directory)) (orig-file (make-temp-name basename)) @@ -221,7 +221,7 @@ (luna-define-method pgg-scheme-insert-key ((scheme pgg-scheme-pgp5)) (let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id)) (args - (list "+verbose=1" "+batchmode=1" "+language=us" "-x" + (list "+verbose=1" "+batchmode=1" "+language=us" "-x" (concat "\"" pgg-pgp5-user-id "\"")))) (pgg-pgp5-process-region (point)(point) nil pgg-pgp5-pgpk-program args) (insert-buffer-substring pgg-output-buffer))) @@ -231,8 +231,8 @@ (let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id)) (basename (expand-file-name "pgg" temporary-file-directory)) (key-file (make-temp-name basename)) - (args - (list "+verbose=1" "+batchmode=1" "+language=us" "-a" + (args + (list "+verbose=1" "+batchmode=1" "+language=us" "-a" key-file))) (write-region-as-raw-text-CRLF start end key-file) (pgg-pgp5-process-region start end nil pgg-pgp5-pgpk-program args) diff --git a/pgg.el b/pgg.el index cae8e27..c254400 100644 --- a/pgg.el +++ b/pgg.el @@ -114,7 +114,7 @@ (luna-define-internal-accessors 'pgg-scheme)) (luna-define-generic pgg-scheme-lookup-key (scheme string &optional type) - "Search keys associated with STRING") + "Search keys associated with STRING.") (luna-define-generic pgg-scheme-encrypt-region (scheme start end recipients) "Encrypt the current region between START and END.") @@ -128,15 +128,13 @@ (luna-define-generic pgg-scheme-verify-region (scheme start end &optional signature) - "Verify region between START and END -as the detached signature SIGNATURE.") + "Verify region between START and END as the detached signature SIGNATURE.") (luna-define-generic pgg-scheme-insert-key (scheme) "Insert public key at point.") (luna-define-generic pgg-scheme-snarf-keys-region (scheme start end) - "Add all public keys in region between START -and END to the keyring.") + "Add all public keys in region between START and END to the keyring.") ;;; @ utility functions ;;; @@ -168,7 +166,7 @@ and END to the keyring.") (defun pgg-temp-buffer-show-function (buffer) (let ((window (split-window-vertically - (- (window-height) + (- (window-height) (/ (window-height) 5))))) (set-window-buffer window buffer))) @@ -178,7 +176,7 @@ and END to the keyring.") (delete-region start end) (insert-buffer-substring pgg-output-buffer) (decode-coding-region start (point) buffer-file-coding-system)) - (let ((temp-buffer-show-function + (let ((temp-buffer-show-function (function pgg-temp-buffer-show-function))) (with-output-to-temp-buffer pgg-echo-buffer (set-buffer standard-output) @@ -258,7 +256,7 @@ and END to the keyring.") (list (region-beginning)(region-end) (split-string (read-string "Recipients: ") "[ \t,]+"))) (let* ((entity (pgg-make-scheme pgg-default-scheme)) - (status + (status (pgg-save-coding-system start end (pgg-scheme-encrypt-region entity (point-min)(point-max) rcpts)))) (when (interactive-p) @@ -315,7 +313,7 @@ signer's public key from `pgg-default-keyserver-address'." (buffer-disable-undo) (set-buffer-multibyte nil) (insert-file-contents signature) - (cdr (assq 2 (pgg-decode-armor-region + (cdr (assq 2 (pgg-decode-armor-region (point-min)(point-max))))))) (scheme (or pgg-scheme -- 1.7.10.4