Function: epg-encrypt-file
epg-encrypt-file is a byte-compiled function defined in epg.el.gz.
Signature
(epg-encrypt-file CONTEXT PLAIN RECIPIENTS CIPHER &optional SIGN ALWAYS-TRUST)
Documentation
Encrypt a file PLAIN and store the result to a file CIPHER.
If CIPHER is nil, it returns the result as a string. If RECIPIENTS is nil, it performs symmetric encryption.
Source Code
;; Defined in /usr/src/emacs/lisp/epg.el.gz
(defun epg-encrypt-file (context plain recipients
cipher &optional sign always-trust)
"Encrypt a file PLAIN and store the result to a file CIPHER.
If CIPHER is nil, it returns the result as a string.
If RECIPIENTS is nil, it performs symmetric encryption."
(unwind-protect
(progn
(setf (epg-context-output-file context)
(or cipher (make-temp-file "epg-output")))
(epg-start-encrypt context (epg-make-data-from-file plain)
recipients sign always-trust)
(epg-wait-for-completion context)
(let ((errors (epg-context-result-for context 'error)))
(if (and sign
(not (epg-context-result-for context 'sign)))
(signal 'epg-error
(list "Sign failed" (epg-errors-to-string errors))))
(if errors
(signal 'epg-error
(list "Encrypt failed" (epg-errors-to-string errors)))))
(unless cipher
(epg-read-output context)))
(unless cipher
(epg-delete-output-file context))
(epg-reset context)))