OSDN Git Service

* epg.el (epg-sign-string): If the GnuPG version is earlier than 1.4.3,
authorDaiki Ueno <ueno@unixuser.org>
Thu, 4 Jan 2007 03:42:11 +0000 (03:42 +0000)
committerDaiki Ueno <ueno@unixuser.org>
Thu, 4 Jan 2007 03:42:11 +0000 (03:42 +0000)
fallback to use a temp file as an input.

ChangeLog
epg.el

index 82a3039..39c3b06 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
 
        * epg.el (epg-signature-to-string): Print creation-time and used
        pubkey-algorithm.
+       (epg-sign-string): If the GnuPG version is earlier than 1.4.3,
+       fallback to use a temp file as an input.
 
 2006-12-31  Daiki Ueno  <ueno@unixuser.org>
 
diff --git a/epg.el b/epg.el
index f3090d1..9e87006 100644 (file)
--- a/epg.el
+++ b/epg.el
@@ -2090,11 +2090,25 @@ Otherwise, it makes a cleartext signature."
 If optional 3rd argument MODE is t or 'detached, it makes a detached signature.
 If it is nil or 'normal, it makes a normal signature.
 Otherwise, it makes a cleartext signature."
+  (let ((input-file (if (or (eq (epg-context-protocol context) 'CMS)
+                           (condition-case nil
+                               (progn
+                                 (epg-check-configuration (epg-configuration))
+                                 t)
+                             (error)))
+                       (epg--make-temp-file "epg-input")))
+       (coding-system-for-write 'binary))
   (unwind-protect
       (progn
        (epg-context-set-output-file context
                                     (epg--make-temp-file "epg-output"))
-       (epg-start-sign context (epg-make-data-from-string plain) mode)
+       (if input-file
+           (write-region plain nil input-file nil 'quiet))
+       (epg-start-sign context
+                       (if input-file
+                           (epg-make-data-from-file input-file)
+                         (epg-make-data-from-string plain))
+                       mode)
        (epg-wait-for-completion context)
        (unless (epg-context-result-for context 'sign)
          (if (epg-context-result-for context 'error)
@@ -2103,7 +2117,9 @@ Otherwise, it makes a cleartext signature."
            (error "Sign failed")))
        (epg-read-output context))
     (epg-delete-output-file context)
-    (epg-reset context)))
+    (if input-file
+       (delete-file input-file))
+    (epg-reset context))))
 
 ;;;###autoload
 (defun epg-start-encrypt (context plain recipients