* pgg.el, pgg-gpg.el, pgg-pgp5.el, pgg-pgp.el:
authorueno <ueno>
Wed, 3 Nov 1999 09:39:14 +0000 (09:39 +0000)
committerueno <ueno>
Wed, 3 Nov 1999 09:39:14 +0000 (09:39 +0000)
Rename generic function `lookup-key' to `lookup-key-string';
add optional argument `type'.

pgg-gpg.el
pgg-parse.el
pgg-pgp.el
pgg-pgp5.el

index d9fb040..e093301 100644 (file)
       )
     ))
 
-(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) 
         (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
         (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
         (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)))
index 237bfe3..0154ea6 100644 (file)
     ;; 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
     ))
      (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
           (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)))
index 1db8d65..1b6f298 100644 (file)
       )
     ))
 
-(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)
         (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"
         (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 
         (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)))
index 6ac145a..6e7a920 100644 (file)
       )
     ))
 
-(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)
         (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
         (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 
         (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)))