关于GPG(2.2.17)与 Emacs (26.1)不兼容的问题

打开一个加密的文件没有问题,但是修改保存的时候出现如下信息: Error while encrypting with “/usr/local/bin/gpg”:

gpg: problem with the agent: Inappropriate ioctl for device gpg: error creating passphrase: Operation cancelled gpg: symmetric encryption of ‘[stdin]’ failed: Operation cancelled

请问:这是什么原因?

官方给出了如下建议:EasyPG Assistant User’s Manual

  1. Do you use GnuPG version 2.1 or 2.0 instead of GnuPG version 1.4?
  2. Do you use symmetric encryption rather than public key encryption?
  3. Do you want to use gpg-agent?

Here are configurations depending on your answers:

1 2 3 Configuration
Yes Yes Yes Set up gpg-agent.
Yes Yes No You can’t, without gpg-agent.
Yes No Yes Set up gpg-agent.
Yes No No You can’t, without gpg-agent.
No Yes Yes Set up elisp passphrase cache.
No Yes No Set up elisp passphrase cache.
No No Yes Set up gpg-agent.
No No No You can’t, without gpg-agent.

我觉得需要配置Set up gpg-agent,那位大神分享一下这方面的经验?谢谢啦 ~

1 个赞

补充一下:这在系统MacOS的终端(iTerm2+zsh)下使用emacs 创建,打开,加解密,功能是没有问题的,界面兼容性差了点。Emacs GUI 下不能更新保存,创建,加解密。 https://v.youku.com/v_show/id_XNDYwNjgxOTAw.html 这个视频给出了保守的设置 (使用GPG1)

加了如下设置,问题解决

(setq epa-pinentry-mode 'loopback)

Reference:

  1. epa - Unable to decrypt .gpg file using emacs but command line gpg works - Emacs Stack Exchange
  2. #24229 - 25.1; Can't set EPA program - GNU bug report logs
  3. Emacs 25 EasyPG Issue
3 个赞

感谢啊,我差点放弃了 :joy: