From: ueno Date: Tue, 25 Apr 2006 05:52:00 +0000 (+0000) Subject: * epg.el (epg-sign-file): Signal an error only when a signature is not X-Git-Tag: epg-0_0_1~23 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7dd310a5477089fc298a838e5676fbed2892e282;p=elisp%2Fepg.git * epg.el (epg-sign-file): Signal an error only when a signature is not created. (epg-sign-string): Ditto. (epg-encrypt-file): Signal an error if SIGN is specified and signature is not created. (epg-encrypt-string): Ditto. --- diff --git a/ChangeLog b/ChangeLog index a069ad8..fcd9e65 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,12 @@ * epg.el (epg-process-sentinel): New function; set 'error if gpg process exited abnormally, but we have not received an error response from it. + (epg-sign-file): Signal an error only when a signature is not + created. + (epg-sign-string): Ditto. + (epg-encrypt-file): Signal an error if SIGN is specified and + signature is not created. + (epg-encrypt-string): Ditto. 2006-04-22 Daiki Ueno diff --git a/epg.el b/epg.el index 123dce8..b32d57a 100644 --- a/epg.el +++ b/epg.el @@ -1235,9 +1235,9 @@ Otherwise, it makes a normal signature." (epg-make-temp-file "epg-output"))) (epg-start-sign context (epg-make-data-from-file plain) mode) (epg-wait-for-completion context) - (if (epg-context-result-for context 'error) - (error "Sign failed: %S" - (epg-context-result-for context 'error))) + (unless (epg-context-result-for context 'sign) + (error "Sign failed: %S" + (epg-context-result-for context 'error))) (unless signature (epg-read-output context))) (unless signature @@ -1257,9 +1257,9 @@ Otherwise, it makes a normal signature." (epg-start-sign context (epg-make-data-from-string plain) mode) (epg-flush context) (epg-wait-for-completion context) - (if (epg-context-result-for context 'error) - (error "Sign failed: %S" - (epg-context-result-for context 'error))) + (unless (epg-context-result-for context 'sign) + (error "Sign failed: %S" + (epg-context-result-for context 'error))) (epg-read-output context)) (epg-delete-output-file context) (epg-reset context))) @@ -1320,6 +1320,10 @@ If RECIPIENTS is nil, it performs symmetric encryption." (epg-start-encrypt context (epg-make-data-from-file plain) recipients sign always-trust) (epg-wait-for-completion context) + (if (and sign + (not (epg-context-result-for context 'sign))) + (error "Sign encrypt failed: %S" + (epg-context-result-for context 'error))) (if (epg-context-result-for context 'error) (error "Encrypt failed: %S" (epg-context-result-for context 'error))) @@ -1342,6 +1346,10 @@ If RECIPIENTS is nil, it performs symmetric encryption." recipients sign always-trust) (epg-flush context) (epg-wait-for-completion context) + (if (and sign + (not (epg-context-result-for context 'sign))) + (error "Sign encrypt failed: %S" + (epg-context-result-for context 'error))) (if (epg-context-result-for context 'error) (error "Encrypt failed: %S" (epg-context-result-for context 'error)))