2

I am having a hard time getting GPG to work in Emacs under Windows.

The configuration options I tried:

  (setq epg-gpg-program "c:/Program Files/GNU/GnuPG/gpg2.exe")

  (setq epg-gpg-home-directory "C:/Documents and Settings/user/My Documents/.gnupg")

Upon opening a .gpg file with Emacs 25 for Windows I get the error

epg-context--make: GPG error: "no usable configuration", OpenPGP

With Emacs 24.3 the error is epa-file--find-file-not-found-function: Opening input file: Decryption failed,

What am I missing?

Do I need some special version of GnuPG?

Additional configuration options?

1 Answers1

5

I had this problem and got it to work. Needed to spelunk through the code in epg.el and epg-config.el to determine what to fiddle with. This is what worked for me:

(custom-set-variables
 '(epg-gpg-home-directory "c:/Users/MYUSER/AppData/Roaming/gnupg")
 '(epg-gpg-program "C:/Progra~2/gnupg/bin/gpg.exe")
 '(epg-gpgconf-program "c:/progra~2/gnupg/bin/gpgconf.exe")
)

My conclusions:

  • epg.el needs gpgconf.exe to determine where all the programs are
  • also needs the home directory for gnupg
  • not sure if gpg-program also needs to be explicitly set as it is present in the output of gpgconf.exe

Give it a shot.

Cheeso
  • 235
  • 3
  • 8
  • Should `M-: (executable-find "gpg")` returns a valid path after setting these variables? Mine returns nil after setting them. And I still have the same problem as OP before and after setting them. – Joseph Tesfaye Dec 17 '19 at 15:07
  • 1
    Restarting Emacs puts it into effect. `eval-buffer` isn't enough, at least for me. – Joseph Tesfaye Dec 17 '19 at 15:44