Function: epg-sign-file

epg-sign-file is a byte-compiled function defined in epg.el.gz.

Signature

(epg-sign-file CONTEXT PLAIN SIGNATURE &optional MODE)

Documentation

Sign a file PLAIN and store the result to a file SIGNATURE.

If SIGNATURE is nil, it returns the result as a string. 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.

Source Code

;; Defined in /usr/src/emacs/lisp/epg.el.gz
(defun epg-sign-file (context plain signature &optional mode)
  "Sign a file PLAIN and store the result to a file SIGNATURE.
If SIGNATURE is nil, it returns the result as a string.
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."
  (unwind-protect
      (progn
        (setf (epg-context-output-file context)
              (or signature (make-temp-file "epg-output")))
	(epg-start-sign context (epg-make-data-from-file plain) mode)
	(epg-wait-for-completion context)
	(unless (epg-context-result-for context 'sign)
	  (let ((errors (epg-context-result-for context 'error)))
	    (signal 'epg-error
		    (list "Sign failed" (epg-errors-to-string errors)))))
	(unless signature
	  (epg-read-output context)))
    (unless signature
      (epg-delete-output-file context))
    (epg-reset context)))