* epg-config.el (epg-passphrase-coding-system): New user option.
authorueno <ueno>
Mon, 4 Sep 2006 06:09:23 +0000 (06:09 +0000)
committerueno <ueno>
Mon, 4 Sep 2006 06:09:23 +0000 (06:09 +0000)
ChangeLog
epg-config.el
epg.el

index 76619e5..e9c8adc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2006-09-04  Daiki Ueno  <ueno@unixuser.org>
 
+       * epg-config.el (epg-passphrase-coding-system): New user option.
+
        * epg.el (epg--list-keys-1): Respect epg-gpg-home-directory.
        (epg--clear-string): New function.
        (epg--status-GET_HIDDEN): Encode passphrase with
index d28fcce..3f15d90 100644 (file)
   :group 'epg
   :type '(choice (const :tag "Default" nil) directory))
 
+(defcustom epg-passphrase-coding-system nil
+  "The coding-system used to type passphrases."
+  :group 'epg
+  :type 'symbol)
+
 (defconst epg-version-number "0.0.4")
 
 (defconst epg-gpg-minimum-version "1.4.3")
diff --git a/epg.el b/epg.el
index 6000dc5..13fd55b 100644 (file)
--- a/epg.el
+++ b/epg.el
@@ -950,11 +950,18 @@ This function is for internal use only."
                  (when passphrase
                    (setq passphrase-with-new-line (concat passphrase "\n"))
                    (epg--clear-string passphrase)
-                   (setq passphrase nil
-                         encoded-passphrase-with-new-line
-                         (encode-coding-string passphrase-with-new-line
-                                               (terminal-coding-system)))
-                   
+                   (setq passphrase nil)
+                   (if epg-passphrase-coding-system
+                       (progn
+                         (setq encoded-passphrase-with-new-line
+                               (encode-coding-string
+                                passphrase-with-new-line
+                                epg-passphrase-coding-system))
+                         (epg--clear-string passphrase-with-new-line)
+                         (setq passphrase-with-new-line nil))
+                     (setq encoded-passphrase-with-new-line
+                           passphrase-with-new-line
+                           passphrase-with-new-line nil))
                    (process-send-string (epg-context-process context)
                                         encoded-passphrase-with-new-line)))
              (quit