Shorten passphrase prompt.
[elisp/epg.git] / epg.el
diff --git a/epg.el b/epg.el
index 2020ebc..cf6cdd4 100644 (file)
--- a/epg.el
+++ b/epg.el
@@ -315,11 +315,17 @@ This function is for internal use only."
   (let ((passphrase
         (funcall (car (epg-context-passphrase-callback-info epg-context))
                  epg-key-id
-                 (cdr (epg-context-passphrase-callback-info epg-context)))))
-    (unwind-protect
-       (if passphrase
-           (process-send-string process (concat passphrase "\n")))
-      (fillarray passphrase 0))))
+                 (cdr (epg-context-passphrase-callback-info epg-context))))
+       string)
+    (if passphrase
+       (unwind-protect
+           (progn
+             (setq string (concat passphrase "\n"))
+             (fillarray passphrase 0)
+             (setq passphrase nil)
+             (process-send-string process string))
+         (if string
+             (fillarray string 0))))))
 
 (defun epg-status-GOODSIG (process string)
   (if (string-match "\\`\\([^ ]+\\) \\(.*\\)" string)
@@ -417,10 +423,10 @@ This function is for internal use only."
 (defun epg-passphrase-callback-function (key-id handback)
   (read-passwd
    (if (eq key-id 'SYM)
-       "GnuPG passphrase for symmetric encryption: "
+       "Passphrase for symmetric encryption: "
      (if (eq key-id 'PIN)
-        "GnuPG passphrase for PIN: "
-       (format "GnuPG passphrase for %s: "
+        "Passphrase for PIN: "
+       (format "Passphrase for %s: "
               (let ((entry (assoc key-id epg-user-id-alist)))
                 (if entry
                     (cdr entry)