I'm trying to encrypt entries with org-crypt, but I get this unhelpful error message:

No crypt key set, using symmetric encryption. Error: (error "Encrypt failed")

It correctly recognizes that I want symmetric (i.e. passphrase) encryption, but doesn't ask for one, and fails instead.

For reference: if I run epa-encrypt-file I do get a dialog for passphrase entry in the minibuffer.

This is the relevant config:

(require 'epa-file)
(require 'org-crypt)

(setq epa-pinentry-mode 'loopback)

;;; (setenv "GPG_AGENT_INFO" nil)


(setq org-tags-exclude-from-inheritance (quote ("crypt")))

;;; GPG key to use for encryption

;;; Either the Key ID or set to nil to use symmetric encryption.

Edit: this is the stack trace - still not very informative...

Debugger entered--Lisp error: (error "Encrypt failed")
  signal(error ("Encrypt failed"))
  error("Encrypt failed")
  org-scan-tags(org-encrypt-entry (lambda (todo tags-list level) (progn (setq org-cached-props nil) (or (and (member "crypt" tags-list))))) nil)
  funcall-interactively(save-buffer 1)
  call-interactively(save-buffer nil nil)
  • Please don't ask the same question both here and on SO. Choose one place (I suggest this one) and delete the question from the other. – NickD Jun 15 at 15:59
  • FWIW, I cannot reproduce the problem. Also, the Encrypt failed error is signaled not by org-crypt itself but from the epg library it uses, specifically from epg-encrypt-string. – NickD Jun 15 at 18:05
  • Thanks. Is there a way to ask emacs to break and dump a trace when the error happens? – Jonathan Sahar Jun 15 at 18:18
  • See Debugging – NickD Jun 15 at 18:31
  • 1
    Part of the problem with the uninformative backtrace is that you probably have a compiled epg library loaded and the debugger cannot get much information out of it. Try (load-library "epg.el") to load the uncompiled library and see if the backtrace gives you any more detail. – NickD Jun 17 at 2:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.