* pgg-pgp.el. pgg-pgp5.el
authorueno <ueno>
Mon, 24 Jan 2000 05:51:19 +0000 (05:51 +0000)
committerueno <ueno>
Mon, 24 Jan 2000 05:51:19 +0000 (05:51 +0000)
(pgg-scheme-verify-region): Don't send buffer contents.

* pgg-pgp.el, pgg-pgp5.el
(pgg-scheme-lookup-key-string): Fix number of arguments against
call-process.

* pgg.el,pgp-gpg.el,pgg-pgp.el,pgg-pgp5.el
(pgg-scheme-lookup-key-string,pgg-scheme-encrypt-region,
pgg-scheme-decrypt-region,pgg-scheme-sign-region,
pgg-scheme-verify-region,pgg-scheme-insert-key,
pgg-scheme-snarf-keys-region): Prepend `pgg-scheme' to each symbol.

* pgg.el
(pgg-encrypt-region,pgg-decrypt-region,pgg-sign-region,
pgg-verify-region,pgg-insert-key,pgg-snarf-keys-region,
pgg-lookup-key-string): Don't use `luna-send'.

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

index e6528b6..676335e 100644 (file)
@@ -1,6 +1,6 @@
 ;;; pgg-gpg.el --- GnuPG support for PGG.
 
-;; Copyright (C) 1999 Daiki Ueno
+;; Copyright (C) 1999,2000 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@ueda.info.waseda.ac.jp>
 ;; Created: 1999/10/28
@@ -53,9 +53,8 @@
   :type 'string)
 
 (eval-and-compile
-  (luna-define-class pgg-scheme-gpg (pgg-scheme))
-  )
-  
+  (luna-define-class pgg-scheme-gpg (pgg-scheme)))
+
 (defvar pgg-gpg-user-id nil
   "GnuPG ID of your default identity.")
 
@@ -96,7 +95,7 @@
      (setq process
           (apply #'start-process-shell-command "*GnuPG*" output-buffer
                  program args)))
-    (set-process-sentinel process 'ignore)
+    (set-process-sentinel process #'ignore)
     (when passphrase
       (process-send-string process (concat passphrase "\n")))
     (process-send-region process start end)
       (delete-file status-file-name)
 
       (if (and process (eq 'run (process-status process)))
-         (interrupt-process process))
-      )
-    ))
+         (interrupt-process process)))))
 
-(luna-define-method lookup-key-string ((scheme pgg-scheme-gpg)
-                                      string &optional type)
+(luna-define-method pgg-scheme-lookup-key-string ((scheme pgg-scheme-gpg)
+                                                 string &optional type)
   (let ((args (list "--with-colons" "--no-greeting" "--batch" 
                    (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
+      (buffer-disable-undo)
+      (erase-buffer)
+      (apply #'call-process pgg-gpg-program nil t nil args)
       (goto-char (point-min))
       (when (re-search-forward "^\\(sec\\|pub\\):"  nil t)
        (substring 
                 (buffer-substring (match-end 0)
                                   (progn (end-of-line)(point)))
                 ":"))
-        8)))
-    ))
+        8)))))
 
-(luna-define-method encrypt-region ((scheme pgg-scheme-gpg) 
-                                   start end recipients)
+(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 
          `("--batch" "--armor" "--always-trust" "--encrypt"
                                         (concat "\"" rcpt "\""))) 
                                 (append recipients
                                         (if pgg-encrypt-for-me
-                                            (list pgg-gpg-user-id)))))))
-         ))
+                                            (list pgg-gpg-user-id)))))))))
     (pgg-as-lbt start end 'CRLF
-      (pgg-gpg-process-region start end nil pgg-gpg-program args)
-      )
+      (pgg-gpg-process-region start end nil pgg-gpg-program args))
     (pgg-process-when-success
-      (pgg-convert-lbt-region (point-min)(point-max) 'LF))
-    ))
+      (pgg-convert-lbt-region (point-min)(point-max) 'LF))))
 
-(luna-define-method decrypt-region ((scheme pgg-scheme-gpg) 
-                                   start end)
+(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 
                      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)
-    ))
+    (pgg-process-when-success nil)))
 
-(luna-define-method sign-region ((scheme pgg-scheme-gpg) 
-                                start end &optional cleartext)
+(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 
         (inhibit-read-only t)
         buffer-read-only)
     (pgg-as-lbt start end 'CRLF
-      (pgg-gpg-process-region start end passphrase pgg-gpg-program args)
-      )
+      (pgg-gpg-process-region start end passphrase pgg-gpg-program args))
     (pgg-process-when-success
       (pgg-convert-lbt-region (point-min)(point-max) 'LF)
       (when (re-search-forward "^-+BEGIN PGP SIGNATURE" nil t);XXX
          (if pgg-cache-passphrase
              (pgg-add-passphrase-cache 
               (cdr (assq 'key-identifier packet))
-              passphrase)))))
-    ))
+              passphrase)))))))
 
-(luna-define-method verify-region ((scheme pgg-scheme-gpg) 
-                                  start end &optional signature)
+(luna-define-method pgg-scheme-verify-region ((scheme pgg-scheme-gpg) 
+                                             start end &optional signature)
   (let ((args '("--batch" "--verify")))
     (when (stringp signature)
       (setq args (append args (list signature))))
            (set-buffer pgg-output-buffer)
            (insert-buffer-substring pgg-errors-buffer)
            t)
-       nil))
-    ))
+       nil))))
 
-(luna-define-method insert-key ((scheme pgg-scheme-gpg))
+(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" 
                     (concat "\"" pgg-gpg-user-id "\""))))
     (pgg-gpg-process-region (point)(point) nil pgg-gpg-program args)
-    (insert-buffer-substring pgg-output-buffer)
-    ))
+    (insert-buffer-substring pgg-output-buffer)))
 
-(luna-define-method snarf-keys-region ((scheme pgg-scheme-gpg)
-                                      start end)
+(luna-define-method pgg-scheme-snarf-keys-region ((scheme pgg-scheme-gpg)
+                                                 start end)
   (let ((args '("--import" "--batch" "-")) status)
     (pgg-gpg-process-region start end nil pgg-gpg-program args)
     (set-buffer pgg-status-buffer)
                "\tSecret keys are imported.\n")))
     (append-to-buffer pgg-output-buffer
                      (point-min)(point-max))
-    (pgg-process-when-success nil)
-    ))
+    (pgg-process-when-success nil)))
 
 (provide 'pgg-gpg)
 
index 9193660..083097f 100644 (file)
@@ -1,6 +1,6 @@
 ;;; pgg-pgp.el --- PGP 2.* and 6.* support for PGG.
 
-;; Copyright (C) 1999 Daiki Ueno
+;; Copyright (C) 1999,2000 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@ueda.info.waseda.ac.jp>
 ;; Created: 1999/11/02
@@ -53,9 +53,8 @@
   :type 'string)
 
 (eval-and-compile
-  (luna-define-class pgg-scheme-pgp (pgg-scheme))
-  )
-  
+  (luna-define-class pgg-scheme-pgp (pgg-scheme)))
+
 (defvar pgg-pgp-user-id nil
   "GnuPG ID of your default identity.")
 
@@ -90,7 +89,7 @@
      (setq process
           (apply #'start-process-shell-command "*PGP*" output-buffer
                  program args)))
-    (set-process-sentinel process 'ignore)
+    (set-process-sentinel process #'ignore)
     (when passphrase
       (process-send-string process (concat passphrase "\n")))
     (process-send-region process start end)
       (delete-file errors-file-name)
       
       (if (and process (eq 'run (process-status process)))
-         (interrupt-process process))
-      )
-    ))
+         (interrupt-process process)))))
 
-(luna-define-method lookup-key-string ((scheme pgg-scheme-pgp) 
-                                      string &optional type)
+(luna-define-method pgg-scheme-lookup-key-string ((scheme pgg-scheme-pgp) 
+                                                 string &optional type)
   (let ((args (list "+batchmode" "+language=en" "-kv" string)))
     (with-current-buffer (get-buffer-create pgg-output-buffer)
       (buffer-disable-undo)
       (erase-buffer)
-      (apply #'call-process pgg-pgp-program nil t args)
+      (apply #'call-process pgg-pgp-program nil t nil args)
       (goto-char (point-min))
       (cond
        ((re-search-forward "^pub\\s +[0-9]+/" nil t);PGP 2.*
        (beginning-of-line 2)
        (substring 
         (nth 2 (split-string 
-                (buffer-substring (point)
-                                  (progn (end-of-line) (point)))
-                ))
-        2))))
-    ))
+                (buffer-substring (point)(progn (end-of-line) (point)))))
+        2))))))
 
-(luna-define-method encrypt-region ((scheme pgg-scheme-pgp) 
-                                   start end recipients)
+(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 
          `("+encrypttoself=off +verbose=1" "+batchmode"
                  (mapcar (lambda (rcpt) (concat "\"" rcpt "\""))
                          (append recipients
                                  (if pgg-encrypt-for-me
-                                     (list pgg-pgp-user-id))))))
-         ))
-    (pgg-pgp-process-region start end nil
-                           pgg-pgp-program args)
-    (pgg-process-when-success nil)
-    ))
+                                     (list pgg-pgp-user-id))))))))
+    (pgg-pgp-process-region start end nil pgg-pgp-program args)
+    (pgg-process-when-success nil)))
 
-(luna-define-method decrypt-region ((scheme pgg-scheme-pgp) 
-                                   start end)
+(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 
                      scheme pgg-pgp-user-id 'encrypt)))
         (args 
          '("+verbose=1" "+batchmode" "+language=us" "-f")))
-    (pgg-pgp-process-region start end passphrase 
-                           pgg-pgp-program args)
-    (pgg-process-when-success nil)
-    ))
+    (pgg-pgp-process-region start end passphrase pgg-pgp-program args)
+    (pgg-process-when-success nil)))
 
-(luna-define-method sign-region ((scheme pgg-scheme-pgp) 
-                                start end &optional clearsign)
+(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 
          (list (if clearsign "-fast" "-fbast")
                "+verbose=1" "+language=us" "+batchmode"
                "-u" pgg-pgp-user-id)))
-    (pgg-pgp-process-region start end passphrase 
-                           pgg-pgp-program args)
+    (pgg-pgp-process-region start end passphrase pgg-pgp-program args)
     (pgg-process-when-success
       (goto-char (point-min))
       (when (re-search-forward "^-+BEGIN PGP" nil t);XXX
          (if pgg-cache-passphrase
              (pgg-add-passphrase-cache 
               (cdr (assq 'key-identifier packet))
-              passphrase)))))
-    ))
+              passphrase)))))))
 
-(luna-define-method verify-region ((scheme pgg-scheme-pgp) 
-                                  start end &optional signature)
+(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))
         (args '("+verbose=1" "+batchmode" "+language=us"))
     (unwind-protect
        (progn
          (set-default-file-modes 448)
-         (write-region-as-binary start end orig-file)
-         )
+         (write-region-as-binary start end orig-file))
       (set-default-file-modes orig-mode))
     (when (stringp signature)
       (copy-file signature (setq signature (concat orig-file ".asc")))
-      (setq args (append args (list signature orig-file)))
-      )
-    (pgg-pgp-process-region (point-min)(point-max) nil
-                           pgg-pgp-program args)
+      (setq args (append args (list signature orig-file))))
+    (pgg-pgp-process-region (point)(point) nil pgg-pgp-program args)
     (delete-file orig-file)
     (if signature (delete-file signature))
     (pgg-process-when-success
       (when (re-search-forward "^\\.$" nil t)
        (delete-region (point-min) 
                       (progn (beginning-of-line 2)
-                             (point)))))
-    ))
+                             (point)))))))
 
-(luna-define-method insert-key ((scheme pgg-scheme-pgp))
+(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" 
                (concat "\"" pgg-pgp-user-id "\""))))
-    (pgg-pgp-process-region (point)(point) nil
-                            pgg-pgp-program args)
-    (insert-buffer-substring pgg-output-buffer)
-    ))
+    (pgg-pgp-process-region (point)(point) nil pgg-pgp-program args)
+    (insert-buffer-substring pgg-output-buffer)))
 
-(luna-define-method snarf-keys-region ((scheme pgg-scheme-pgp)
-                                      start end)
+(luna-define-method pgg-scheme-snarf-keys-region ((scheme pgg-scheme-pgp)
+                                                 start end)
   (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))
          (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)
+    (pgg-pgp-process-region start end nil pgg-pgp-program args)
     (delete-file key-file)
-    (pgg-process-when-success nil)
-    ))
+    (pgg-process-when-success nil)))
 
 (provide 'pgg-pgp)
 
index e8066fb..442a932 100644 (file)
@@ -1,6 +1,6 @@
 ;;; pgg-pgp5.el --- PGP 5.* support for PGG.
 
-;; Copyright (C) 1999 Daiki Ueno
+;; Copyright (C) 1999,2000 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@ueda.info.waseda.ac.jp>
 ;; Created: 1999/11/02
@@ -68,9 +68,8 @@
   :type 'string)
 
 (eval-and-compile
-  (luna-define-class pgg-scheme-pgp5 (pgg-scheme))
-  )
-  
+  (luna-define-class pgg-scheme-pgp5 (pgg-scheme)))
+
 (defvar pgg-pgp5-user-id nil
   "GnuPG ID of your default identity.")
 
      (setq process
           (apply #'start-process-shell-command "*PGP*" output-buffer
                  program args)))
-    (set-process-sentinel process 'ignore)
+    (set-process-sentinel process #'ignore)
     (when passphrase
       (process-send-string process (concat passphrase "\n")))
     (process-send-region process start end)
       (delete-file errors-file-name)
       
       (if (and process (eq 'run (process-status process)))
-         (interrupt-process process))
-      )
-    ))
+         (interrupt-process process)))))
 
-(luna-define-method lookup-key-string ((scheme pgg-scheme-pgp5) 
-                                      string &optional type)
+(luna-define-method pgg-scheme-lookup-key-string ((scheme pgg-scheme-pgp5) 
+                                                 string &optional type)
   (let ((args (list "+language=en" "-l" string)))
     (with-current-buffer (get-buffer-create pgg-output-buffer)
       (buffer-disable-undo)
       (erase-buffer)
-      (apply #'call-process pgg-pgp5-pgpk-program  nil t args)
+      (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 
-                (buffer-substring (match-end 0)
-                                  (progn (end-of-line)(point)))
-                ))
-        2)))
-    ))
-
-(luna-define-method encrypt-region ((scheme pgg-scheme-pgp5) 
-                                   start end recipients)
+                (buffer-substring (match-end 0)(progn (end-of-line)(point)))))
+        2)))))
+
+(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 
          `("+NoBatchInvalidKeys=off" "-fat" "+batchmode=1"
                                         (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 decrypt-region ((scheme pgg-scheme-pgp5) 
-                                   start end)
+                                            (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) 
+                                              start end)
   (let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id))
         (passphrase
          (pgg-read-passphrase 
                      scheme pgg-pgp5-user-id 'encrypt)))
         (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)
-    ))
+    (pgg-pgp5-process-region start end passphrase pgg-pgp5-pgpv-program args)
+    (pgg-process-when-success nil)))
 
-(luna-define-method sign-region ((scheme pgg-scheme-pgp5) 
-                                start end &optional clearsign)
+(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 
          (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-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 
          (if pgg-cache-passphrase
              (pgg-add-passphrase-cache 
               (cdr (assq 'key-identifier packet))
-              passphrase)))))
-    ))
+              passphrase)))))))
 
-(luna-define-method verify-region ((scheme pgg-scheme-pgp5) 
-                                  start end &optional signature)
+(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))
         (args '("+verbose=1" "+batchmode=1" "+language=us"))
     (unwind-protect
        (progn
          (set-default-file-modes 448)
-         (write-region-as-binary start end orig-file)
-         )
+         (write-region-as-binary start end orig-file))
       (set-default-file-modes orig-mode))
     (when (stringp signature)
       (copy-file signature (setq signature (concat orig-file ".asc")))
-      (setq args (append args (list signature)))
-      )
-    (pgg-pgp5-process-region (point-min)(point-max) nil
-                            pgg-pgp5-pgpv-program args)
+      (setq args (append args (list signature))))
+    (pgg-pgp5-process-region (point)(point) nil pgg-pgp5-pgpv-program args)
     (delete-file orig-file)
     (if signature (delete-file signature))
-    (pgg-process-when-success nil)
-    ))
+    (pgg-process-when-success nil)))
 
-(luna-define-method insert-key ((scheme pgg-scheme-pgp5))
+(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" 
                (concat "\"" pgg-pgp5-user-id "\""))))
-    (pgg-pgp5-process-region (point)(point) nil
-                            pgg-pgp5-pgpk-program args)
-    (insert-buffer-substring pgg-output-buffer)
-    ))
+    (pgg-pgp5-process-region (point)(point) nil pgg-pgp5-pgpk-program args)
+    (insert-buffer-substring pgg-output-buffer)))
 
-(luna-define-method snarf-keys-region ((scheme pgg-scheme-pgp5)
-                                      start end)
+(luna-define-method pgg-scheme-snarf-keys-region ((scheme pgg-scheme-pgp5)
+                                                 start end)
   (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))
          (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)
+    (pgg-pgp5-process-region start end nil pgg-pgp5-pgpk-program args)
     (delete-file key-file)
-    (pgg-process-when-success nil)
-    ))
+    (pgg-process-when-success nil)))
 
 (provide 'pgg-pgp5)
 
diff --git a/pgg.el b/pgg.el
index fd6eaea..4557a6d 100644 (file)
--- a/pgg.el
+++ b/pgg.el
@@ -1,6 +1,6 @@
 ;;; pgg.el --- glue for the various PGP implementations.
 
-;; Copyright (C) 1999 Daiki Ueno
+;; Copyright (C) 1999,2000 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@ueda.info.waseda.ac.jp>
 ;; Created: 1999/10/28
@@ -47,8 +47,7 @@
   (calist field-type field-value)
   (let ((s-field (assq field-type calist)))
     (cond ((null s-field)
-          (cons (cons field-type field-value) calist)
-          )
+          (cons (cons field-type field-value) calist))
          ((memq (cdr s-field) field-value)
           calist))))
 
 (eval-and-compile
   (luna-define-class pgg-scheme ())
 
-  (luna-define-internal-accessors 'pgg-scheme)
-  )
+  (luna-define-internal-accessors 'pgg-scheme))
 
-(luna-define-generic lookup-key-string (scheme string &optional type)
+(luna-define-generic pgg-scheme-lookup-key-string
+  (scheme string &optional type)
   "Search keys associated with STRING")
 
-(luna-define-generic encrypt-region (scheme start end recipients)
+(luna-define-generic pgg-scheme-encrypt-region (scheme start end recipients)
   "Encrypt the current region between START and END.")
 
-(luna-define-generic decrypt-region (scheme start end)
+(luna-define-generic pgg-scheme-decrypt-region (scheme start end)
   "Decrypt the current region between START and END.")
 
-(luna-define-generic sign-region (scheme start end &optional cleartext)
+(luna-define-generic pgg-scheme-sign-region
+  (scheme start end &optional cleartext)
   "Make detached signature from text between START and END.")
 
-(luna-define-generic verify-region (scheme start end &optional signature)
+(luna-define-generic pgg-scheme-verify-region
+  (scheme start end &optional signature)
   "Verify region between START and END
 as the detached signature SIGNATURE.")
 
-(luna-define-generic insert-key (scheme)
+(luna-define-generic pgg-scheme-insert-key (scheme)
   "Insert public key at point.")
 
-(luna-define-generic snarf-keys-region (scheme start end)
+(luna-define-generic pgg-scheme-snarf-keys-region (scheme start end)
   "Add all public keys in region between START
 and END to the keyring.")
 
@@ -161,8 +162,7 @@ and END to the keyring.")
                                   buffer-file-coding-system)
             (prog1 (save-excursion ,@body)
               (push nil buffer-undo-list)
-              (ignore-errors (undo)))
-            )))
+              (ignore-errors (undo))))))
      (save-restriction
        (narrow-to-region ,start ,end)
        ,@body)))
@@ -180,14 +180,12 @@ and END to the keyring.")
       (progn
        (delete-region start end)
        (insert-buffer-substring pgg-output-buffer)
-       (decode-coding-region start (point) buffer-file-coding-system)
-       )
+       (decode-coding-region start (point) buffer-file-coding-system))
     (let ((temp-buffer-show-function 
           (function pgg-temp-buffer-show-function)))
       (with-output-to-temp-buffer pgg-echo-buffer
        (set-buffer standard-output)
-       (insert-buffer-substring pgg-errors-buffer)))
-    ))
+       (insert-buffer-substring pgg-errors-buffer)))))
 
 (defvar pgg-passphrase-cache-expiry 16)
 (defvar pgg-passphrase-cache (make-vector 7 0))
@@ -232,8 +230,7 @@ and END to the keyring.")
          (forward-line 1)))
        (LF
        (while (re-search-forward "\r$" pgg-conversion-end t)
-         (replace-match ""))))
-     ))
+         (replace-match ""))))))
 
 (put 'pgg-as-lbt 'lisp-indent-function 3)
 
@@ -264,9 +261,9 @@ 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 (pgg-save-coding-system start end
-                  (luna-send entity 'encrypt-region entity
-                             (point-min)(point-max) rcpts))))
+        (status 
+         (pgg-save-coding-system start end
+           (pgg-scheme-encrypt-region entity (point-min)(point-max) rcpts))))
     (when (interactive-p)
       (pgg-display-output-buffer start end status))
     status))
@@ -285,9 +282,9 @@ and END to the keyring.")
                                               packet))))
              pgg-default-scheme))
         (entity (pgg-make-scheme scheme))
-        (status (pgg-save-coding-system start end
-                  (luna-send entity 'decrypt-region entity 
-                             (point-min)(point-max)))))
+        (status
+         (pgg-save-coding-system start end
+           (pgg-scheme-decrypt-region entity (point-min)(point-max)))))
     (when (interactive-p)
       (pgg-display-output-buffer start end status))
     status))
@@ -300,9 +297,8 @@ a detached signature."
   (interactive "r")
   (let* ((entity (pgg-make-scheme pgg-default-scheme))
         (status (pgg-save-coding-system start end
-                  (luna-send entity 'sign-region entity
-                             (point-min)(point-max)
-                             (or (interactive-p) cleartext)))))
+                  (pgg-scheme-sign-region entity (point-min)(point-max)
+                                          (or (interactive-p) cleartext)))))
     (when (interactive-p)
       (pgg-display-output-buffer start end status))
     status))
@@ -322,8 +318,8 @@ 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 (point-min)(point-max))))
-             )))
+             (cdr (assq 2 (pgg-decode-armor-region 
+                           (point-min)(point-max)))))))
         (scheme
          (or pgg-scheme
              (cdr (assq 'scheme
@@ -346,16 +342,15 @@ signer's public key from `pgg-default-keyserver-address'."
                   pgg-default-keyserver-address))
         (pgg-fetch-key keyserver key))
     (setq status (pgg-save-coding-system start end
-                  (luna-send entity 'verify-region entity 
-                             (point-min)(point-max) signature)))
+                  (pgg-scheme-verify-region entity (point-min)(point-max)
+                                            signature)))
     (when (interactive-p)
       (let ((temp-buffer-show-function
             (function pgg-temp-buffer-show-function)))
        (with-output-to-temp-buffer pgg-echo-buffer
          (set-buffer standard-output)
          (insert-buffer-substring (if status pgg-output-buffer
-                                    pgg-errors-buffer))
-         )))
+                                    pgg-errors-buffer)))))
     status))
 
 ;;;###autoload
@@ -363,7 +358,7 @@ signer's public key from `pgg-default-keyserver-address'."
   "Insert the ASCII armored public key."
   (interactive)
   (let ((entity (pgg-make-scheme (or pgg-scheme pgg-default-scheme))))
-    (luna-send entity 'insert-key entity)))
+    (pgg-scheme-insert-key entity)))
 
 ;;;###autoload
 (defun pgg-snarf-keys-region (start end)
@@ -371,11 +366,11 @@ signer's public key from `pgg-default-keyserver-address'."
   (interactive "r")
   (let ((entity (pgg-make-scheme (or pgg-scheme pgg-default-scheme))))
     (pgg-save-coding-system start end
-      (luna-send entity 'snarf-keys-region entity start end))))
+      (pgg-scheme-snarf-keys-region entity start end))))
 
 (defun pgg-lookup-key-string (string &optional type)
   (let ((entity (pgg-make-scheme (or pgg-scheme pgg-default-scheme))))
-    (luna-send entity 'lookup-key-string entity string type)))
+    (pgg-scheme-lookup-key-string entity string type)))
 
 (defvar pgg-insert-url-function  (function pgg-insert-url-with-w3))
 
@@ -402,8 +397,7 @@ signer's public key from `pgg-default-keyserver-address'."
        (delete-process process)
        (if (and process (eq 'run (process-status process)))
           (interrupt-process process))
-       (buffer-string)))
-    ))
+       (buffer-string)))))
 
 (defun pgg-fetch-key (keyserver key)
   "Attempt to fetch a KEY from KEYSERVER for addition to PGP or GnuPG keyring."
@@ -425,8 +419,7 @@ signer's public key from `pgg-default-keyserver-address'."
        (insert "\n")
        (with-temp-buffer
          (insert-buffer-substring pgg-output-buffer)
-         (pgg-snarf-keys-region (point-min)(point-max))))
-      )))
+         (pgg-snarf-keys-region (point-min)(point-max)))))))
 
 
 (provide 'pgg)