args)))
(set-default-file-modes orig-mode))
(set-process-filter process #'epg--process-filter)
- (set-process-sentinel process #'ignore)
(epg-context-set-process context process)))
(defun epg--process-filter (process input)
(string (match-string 2))
(symbol (intern-soft (concat "epg--status-"
status))))
- (forward-line)
- (setq epg-read-point (point))
(if (member status epg-pending-status-list)
(setq epg-pending-status-list nil))
(if (and symbol
(fboundp symbol))
(funcall symbol epg-context string))
- (goto-char epg-read-point)
- (setq epg-last-status (cons status string)))
- (forward-line)
- (setq epg-read-point (point)))))
+ (setq epg-last-status (cons status string))))
+ (forward-line)
+ (setq epg-read-point (point))))
(setq epg-process-filter-running nil))))))
(defun epg-read-output (context)
(while (eq (process-status (epg-context-process context)) 'run)
(accept-process-output (epg-context-process context) 1)))
-(defun epg-wait-for-plaintext (context length)
- "Wait data from the `epg-gpg-program' process."
- (while (and (eq (process-status (epg-context-process context)) 'run)
- (< (- (point-max) epg-read-point) length))
- (accept-process-output (epg-context-process context) 1)))
-
(defun epg-reset (context)
"Reset the CONTEXT."
(if (and (epg-context-process context)
(if (consp (epg-context-progress-callback context))
(cdr (epg-context-progress-callback context))))))
-(defun epg--status-BEGIN_DECRYPTION (context string)
- (epg-context-set-result-for context 'plaintext nil))
-
(defun epg--status-DECRYPTION_FAILED (context string)
(epg-context-set-result-for context 'decryption-failed t))
(defun epg--status-DECRYPTION_OKAY (context string)
- (epg-context-set-result-for context 'decryption-okay t)
- (epg-context-set-result-for
- context
- 'decrypted-plaintext
- (epg-context-result-for context 'plaintext)))
-
-(defun epg--status-PLAINTEXT_LENGTH (context string)
- (when (string-match "\\`\\([0-9]+\\)" string)
- (let ((length (string-to-number (match-string 1 string))))
- (epg-wait-for-plaintext context length)
- (epg-context-set-result-for
- context 'plaintext
- (buffer-substring epg-read-point
- (setq epg-read-point (+ epg-read-point length)))))))
+ (epg-context-set-result-for context 'decryption-okay t))
(defun epg--status-NODATA (context string)
(epg-context-set-result-for
(unwind-protect
(progn
(write-region cipher nil input-file nil 'quiet)
+ (epg-context-set-output-file context
+ (epg--make-temp-file "epg-output"))
(epg-start-decrypt context (epg-make-data-from-file input-file))
(epg-wait-for-completion context)
(epg--check-error-for-decrypt context)
- (epg-context-result-for context 'decrypted-plaintext))
+ (epg-read-output context))
+ (epg-delete-output-file context)
(if (file-exists-p input-file)
(delete-file input-file))
(epg-reset context))))
(unwind-protect
(progn
(if plain
- (epg-context-set-output-file context plain))
+ (epg-context-set-output-file context plain)
+ (epg-context-set-output-file context
+ (epg--make-temp-file "epg-output")))
(if signed-text
(epg-start-verify context
(epg-make-data-from-file signature)
(epg-make-data-from-file signature)))
(epg-wait-for-completion context)
(unless plain
- (epg-context-result-for context 'plaintext)))
+ (epg-read-output context)))
+ (unless plain
+ (epg-delete-output-file context))
(epg-reset context)))
;;;###autoload
input-file)
(unwind-protect
(progn
+ (epg-context-set-output-file context
+ (epg--make-temp-file "epg-output"))
(if signed-text
(progn
(setq input-file (epg--make-temp-file "epg-signature"))
(epg-make-data-from-string signed-text)))
(epg-start-verify context (epg-make-data-from-string signature)))
(epg-wait-for-completion context)
- (epg-context-result-for context 'plaintext))
+ (epg-read-output context))
+ (epg-delete-output-file context)
(if (and input-file
(file-exists-p input-file))
(delete-file input-file))