0

Emacs 24.5.1 in cygwin x64, Windows 7, gpg (GnuPG) 2.0.21 (Gpg4win 2.2.0)

Visited file ~/somefile.gpg

Got error "Opening input file" "Can't decrypt" "Exit".

Debugger entered--Lisp error: (file-error "Opening input file" "Can't decrypt" "Exit")
  signal(file-error ("Opening input file" "Can't decrypt" "Exit"))
  epa-file--find-file-not-found-function()
  run-hook-with-args-until-success(epa-file--find-file-not-found-function)
  #[257 "..." [#<killed buffer> "~/somefile.gpg" (nil) file-exists-p file-readable-p kill-buffer signal file-error "File is not readable" run-hook-with-args-until-success find-file-not-found-functions t] 5 "\n\n(fn IGNORED)"]((file-error "Opening input file" "Can't decrypt" "Exit"))
  funcall(#[257 "..." [#<killed buffer> "~/somefile.gpg" (nil) file-exists-p file-readable-p kill-buffer signal file-error "File is not readable" run-hook-with-args-until-success find-file-not-found-functions t] 5 "\n\n(fn IGNORED)"] (file-error "Opening input file" "Can't decrypt" "Exit"))
  find-file-noselect-1(#<killed buffer> "~/somefile.gpg" nil nil "~/somefile.gpg" (10696049115278578 2661856658))
  find-file-noselect("~/somefile.gpg" nil nil t)
  eval((find-file-noselect "~/somefile.gpg" nil nil t) nil)
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

.emacs, emacs.bat to launch just in case.

pusheax
  • 53
  • 5

1 Answers1

0

After a lot of research I found out that emacs + gpg4win does not work. On one windows machine however I had working configuration. But it used cygwin's gnupg. So the solution is to install and use in PATH cygwin's gpg (Utils -> gnupg).

To determine in emacs that you have good gpg use:

sh-4.3$ which gpg
/usr/bin/gpg

More details on why it does not work. Following command

(start-process "epg" "buffer-name" "gpg" "--no-tty" "--status-fd" "1" "--yes" "--command-fd" "0" "--output" "/cygdrive/c/Users/username/AppData/Local/Temp/epg-output4840pv2" "--symmetric")

Results in:

gpg: can't create `/cygdrive/c/Users/pusheax/AppData/Local/Temp/epg-output4840pv2': No such file or directory

[GNUPG:] FAILURE symencrypt 33587281

gpg: symmetric encryption of `[stdin]' failed: No such file or directory


Process epg exited abnormally with code 2

Following command with windows path works:

(start-process "epg" "pgpout" "gpg" "--no-tty" "--status-fd" "1" "--yes" "--command-fd" "0" "--output" "d:/epg-output" "--symmetric")
pusheax
  • 53
  • 5