;;; epg.el --- the EasyPG Library -*- lexical-binding: t -*-
-;; Copyright (C) 1999-2000, 2002-2015 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2000, 2002-2016 Free Software Foundation, Inc.
;; Author: Daiki Ueno <ueno@unixuser.org>
;; Keywords: PGP, GnuPG
compress-algorithm
&aux
(program
- (pcase protocol
- (`OpenPGP epg-gpg-program)
- (`CMS epg-gpgsm-program)
- (_ (signal 'epg-error
- (list "unknown protocol" protocol)))))))
+ (let ((configuration (epg-find-configuration protocol)))
+ (unless configuration
+ (signal 'epg-error
+ (list "no usable configuration" protocol)))
+ (alist-get 'program configuration)))))
(:copier nil)
(:predicate nil))
protocol
(setq process-environment
(cons (concat "GPG_TTY=" terminal-name)
(cons "TERM=xterm" process-environment))))
- ;; Start the Emacs Pinentry server if allow-emacs-pinentry is set
- ;; in ~/.gnupg/gpg-agent.conf.
+ ;; Automatically start the Emacs Pinentry server if appropriate.
(when (and (fboundp 'pinentry-start)
+ ;; Emacs Pinentry is useless if Emacs has no interactive session.
+ (not noninteractive)
+ ;; Prefer pinentry-mode over Emacs Pinentry.
+ (null (epg-context-pinentry-mode context))
+ ;; Check if the allow-emacs-pinentry option is set.
(executable-find epg-gpgconf-program)
(with-temp-buffer
(when (= (call-process epg-gpgconf-program nil t nil
If it is nil or `normal', it makes a normal signature.
Otherwise, it makes a cleartext signature."
(let ((input-file
- (unless (or (eq (epg-context-protocol context) 'CMS)
- (condition-case nil
- (progn
- (epg-check-configuration (epg-configuration))
- t)
- (error)))
+ (unless (eq (epg-context-protocol context) 'CMS)
(epg--make-temp-file "epg-input")))
(coding-system-for-write 'binary))
(unwind-protect
If RECIPIENTS is nil, it performs symmetric encryption."
(let ((input-file
(unless (or (not sign)
- (eq (epg-context-protocol context) 'CMS)
- (condition-case nil
- (progn
- (epg-check-configuration (epg-configuration))
- t)
- (error)))
+ (eq (epg-context-protocol context) 'CMS))
(epg--make-temp-file "epg-input")))
(coding-system-for-write 'binary))
(unwind-protect