From: ueno Date: Wed, 3 Nov 1999 09:39:14 +0000 (+0000) Subject: * pgg.el, pgg-gpg.el, pgg-pgp5.el, pgg-pgp.el: X-Git-Tag: emiko-1_13_7~96 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=64a3c8ec4fac33a768ffdea0e4003ed1e1004875;p=elisp%2Fsemi.git * pgg.el, pgg-gpg.el, pgg-pgp5.el, pgg-pgp.el: Rename generic function `lookup-key' to `lookup-key-string'; add optional argument `type'. --- diff --git a/pgg-gpg.el b/pgg-gpg.el index d9fb040..e093301 100644 --- a/pgg-gpg.el +++ b/pgg-gpg.el @@ -124,17 +124,21 @@ ) )) -(luna-define-method lookup-key ((scheme pgg-scheme-gpg) string) +(luna-define-method lookup-key-string ((scheme pgg-scheme-gpg) + string &optional type) (let ((args (list "--with-colons" "--no-greeting" "--batch" - "--list-secret-keys" string))) + (if type "--list-secret-keys" "--list-keys") + string))) (pgg-gpg-process-region (point)(point) nil pgg-gpg-program args) (with-current-buffer pgg-output-buffer (goto-char (point-min)) (when (re-search-forward "^\\(sec\\|pub\\):" nil t) - (nth 3 (split-string - (buffer-substring (match-end 0) - (progn (end-of-line)(point))) - ":")))) + (substring + (nth 3 (split-string + (buffer-substring (match-end 0) + (progn (end-of-line)(point))) + ":")) + 8))) )) (luna-define-method encrypt-region ((scheme pgg-scheme-gpg) @@ -143,7 +147,8 @@ (passphrase (pgg-read-passphrase (format "GnuPG passphrase for %s: " pgg-gpg-user-id) - (luna-send scheme 'lookup-key scheme pgg-gpg-user-id))) + (luna-send scheme 'lookup-key-string + scheme pgg-gpg-user-id 'encrypt))) (args `("--batch" "--armor" "--textmode" "--always-trust" "--encrypt" ,@(if recipients @@ -170,7 +175,8 @@ (passphrase (pgg-read-passphrase (format "GnuPG passphrase for %s: " pgg-gpg-user-id) - (luna-send scheme 'lookup-key scheme pgg-gpg-user-id))) + (luna-send scheme 'lookup-key-string + scheme pgg-gpg-user-id 'encrypt))) (args '("--batch" "--decrypt"))) (pgg-gpg-process-region start end passphrase pgg-gpg-program args) (with-current-buffer pgg-output-buffer @@ -184,7 +190,8 @@ (passphrase (pgg-read-passphrase (format "GnuPG passphrase for %s: " pgg-gpg-user-id) - (luna-send scheme 'lookup-key scheme pgg-gpg-user-id))) + (luna-send scheme 'lookup-key-string + scheme pgg-gpg-user-id 'sign))) (args (list "--detach-sign" "--armor" "--batch" "--verbose" "--local-user" pgg-gpg-user-id))) diff --git a/pgg-parse.el b/pgg-parse.el index 237bfe3..0154ea6 100644 --- a/pgg-parse.el +++ b/pgg-parse.el @@ -234,14 +234,14 @@ ;; 7 -- Secret Subkey Packet ;; 8 -- Compressed Data Packet (9 ;Symmetrically Encrypted Data Packet - (pgg-read-body ptag)) + (pgg-read-body-string ptag)) (10 ;Marker Packet - (pgg-read-body ptag)) + (pgg-read-body-string ptag)) (11 ;Literal Data Packet - (pgg-read-body ptag)) + (pgg-read-body-string ptag)) ;; 12 -- Trust Packet (13 ;User ID Packet - (pgg-read-body ptag)) + (pgg-read-body-string ptag)) ;; 14 -- Public Subkey Packet ;; 60 .. 63 -- Private or Experimental Values )) @@ -288,7 +288,7 @@ (cons 'trust-level (pgg-read-byte))) (6 ;regular expression (cons 'regular-expression - (pgg-read-body ptag))) + (pgg-read-body-string ptag))) (7 ;revocable (cons 'revocability (pgg-read-byte))) (9 ;key expiration time @@ -326,8 +326,11 @@ (cdr (assq (pgg-read-byte) pgg-parse-compression-algorithm-alist)))) (23 ;key server preferences - ) - ;; 24 = preferred key server + (cons 'key-server-preferences + (pgg-read-body ptag))) + (24 ;preferred key server + (cons 'preferred-key-server + (pgg-read-body-string ptag))) ;; 25 = primary user id (26 ;policy URL (cons 'policy-url (pgg-read-body-string ptag))) diff --git a/pgg-pgp.el b/pgg-pgp.el index 1db8d65..1b6f298 100644 --- a/pgg-pgp.el +++ b/pgg-pgp.el @@ -111,7 +111,8 @@ ) )) -(luna-define-method lookup-key ((scheme pgg-scheme-pgp) string) +(luna-define-method lookup-key-string ((scheme pgg-scheme-pgp) + string &optional type) (let ((args (list "+batchmode" "+language=en" "-kv" string))) (pgg-pgp-process-region (point)(point) nil pgg-pgp-program args) @@ -136,7 +137,8 @@ (passphrase (pgg-read-passphrase (format "PGP passphrase for %s: " pgg-pgp-user-id) - (luna-send scheme 'lookup-key scheme pgg-pgp-user-id))) + (luna-send scheme 'lookup-key-string + scheme pgg-pgp-user-id 'encrypt))) (args `("+encrypttoself=off +verbose=1" "+batchmode" "+language=us" "-fate" @@ -162,7 +164,8 @@ (passphrase (pgg-read-passphrase (format "PGP passphrase for %s: " pgg-pgp-user-id) - (luna-send scheme 'lookup-key scheme pgg-pgp-user-id))) + (luna-send scheme 'lookup-key-string + scheme pgg-pgp-user-id 'encrypt))) (args '("+verbose=1" "+batchmode" "+language=us" "-f"))) (pgg-pgp-process-region start end passphrase @@ -178,7 +181,8 @@ (passphrase (pgg-read-passphrase (format "PGP passphrase for %s: " pgg-pgp-user-id) - (luna-send scheme 'lookup-key scheme pgg-pgp-user-id))) + (luna-send scheme 'lookup-key-string + scheme pgg-pgp-user-id 'sign))) (args (list "-fbast" "+verbose=1" "+language=us" "+batchmode" "-u" pgg-pgp-user-id))) diff --git a/pgg-pgp5.el b/pgg-pgp5.el index 6ac145a..6e7a920 100644 --- a/pgg-pgp5.el +++ b/pgg-pgp5.el @@ -126,7 +126,8 @@ ) )) -(luna-define-method lookup-key ((scheme pgg-scheme-pgp5) string) +(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) @@ -147,7 +148,8 @@ (passphrase (pgg-read-passphrase (format "PGP passphrase for %s: " pgg-pgp5-user-id) - (luna-send scheme 'lookup-key scheme pgg-pgp5-user-id))) + (luna-send scheme 'lookup-key-string + scheme pgg-pgp5-user-id 'encrypt))) (args `("+NoBatchInvalidKeys=off" "-fat" "+batchmode=1" ,@(if recipients @@ -175,7 +177,8 @@ (passphrase (pgg-read-passphrase (format "PGP passphrase for %s: " pgg-pgp5-user-id) - (luna-send scheme 'lookup-key scheme pgg-pgp5-user-id))) + (luna-send scheme 'lookup-key-string + scheme pgg-pgp5-user-id 'encrypt))) (args '("+verbose=1" "+batchmode=1" "+language=us" "-f"))) (pgg-pgp5-process-region start end passphrase @@ -191,7 +194,8 @@ (passphrase (pgg-read-passphrase (format "PGP passphrase for %s: " pgg-pgp5-user-id) - (luna-send scheme 'lookup-key scheme pgg-pgp5-user-id))) + (luna-send scheme 'lookup-key-string + scheme pgg-pgp5-user-id 'sign))) (args (list "-fbat" "+verbose=1" "+language=us" "+batchmode=1" "-u" pgg-pgp5-user-id)))