From 641b06f66ab2e8225cdd38c0e11ee6955b583598 Mon Sep 17 00:00:00 2001 From: ueno Date: Thu, 4 Jan 2007 03:42:11 +0000 Subject: [PATCH] * epg.el (epg-sign-string): If the GnuPG version is earlier than 1.4.3, fallback to use a temp file as an input. --- ChangeLog | 2 ++ epg.el | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 82a3039..39c3b06 100644 --- 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 diff --git a/epg.el b/epg.el index f3090d1..9e87006 100644 --- 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 -- 1.7.10.4