3

I am looking for Emacs password manager, and org-password-manager looks nice for my needs.

But when I am trying to open created passwords.org.gpg file (I use symmetric encryption for more ease), Emacs each time show me a pop-up windows, asking my passphrase. Is it possible to use minibuffer for this (instead of pop-up window)?

enter image description here

I have (setq use-dialog-box nil) in my .emacs file, but it does not help in this case.

drobnbobn
  • 575
  • 4
  • 15
  • Are you running `(epa-file-enable)` in your init file? – Jules Mar 07 '16 at 15:45
  • @JulesTamagnan, yes, I have that line in my .emacs file. – drobnbobn Mar 07 '16 at 15:48
  • I think for opening files in emacs thats all I needed. I also have a bit in my bashrc that I haven't touched in a while so that may help. Also for programs that are not related to emacs I use https://github.com/ecraven/pinentry-emacs to route the password selection to my minibuffer – Jules Mar 07 '16 at 15:53
  • Is this by any chance the `askpass` program pop-up window? If so, the simplest solution is to uninstall `askpass` or friends (KDE has its own version of it). When this program is installed many other programs which require authentication will use it to collect user's credentials, which is generally not what you expect from Emacs. – wvxvw Mar 07 '16 at 15:56
  • @wvxvw I use Xfce and have `KeePass2` and `KeePassX` both installed, but I don't find `askpass` on my PC. Should I uninstall them? Also: I added image to my post with asking-pop-up. – drobnbobn Mar 07 '16 at 16:12
  • @JulesTamagnan, sorry I don't understand the purpose of `pinentry-emacs` and it has poor documentation. Could you say what problem does it solve? – drobnbobn Mar 07 '16 at 16:19
  • I only ever used Xfce with a different theme, and don't remember using `KeePass`, so I cannot recognize it. However, once the pop-up is active, you could list processes in a separate terminal and see if that program is listed there. Wrt uninstalling: there's no harm in uninstalling it. Worst case: you could always install it again, if you will miss it. – wvxvw Mar 07 '16 at 16:37
  • @wvxvw, I completely removed `KeePass2` and `KeePassX`, restart my PC and tried to open `passwords.org.gpg` file again. Sadly, but Emacs shows me same pop-up window. – drobnbobn Mar 07 '16 at 16:49
  • OK, then probably the program which decides what dialog to show is `pinentry`, just as @JulesTamagnan suggested. You can read more about it `M-: (info "(pinentry)Front ends")`. – wvxvw Mar 07 '16 at 17:13

1 Answers1

3

I am moving my comment to an answer explaining how pinentry-emacs works because of formatting

pinentry-emacs stops the window from popping up that asks for your password and insteads asks for your password through the minibuffer.

It is super poorly documented and took me a bit of time to set up. From what I can tell I placed

(pinentry-start)
(defun pinentry-emacs (desc prompt ok error)
  (let ((str (read-passwd (concat (replace-regexp-in-string "%22" "\"" (replace-regexp-in-string "%0A" "\n" desc)) prompt ": "))))
    str))

into my init file and then I put

pinentry-program /home/--name--/.emacs.d/dotEmacs/pinentry/pinentry-emacs

into ~/.gnupg/gpg-agent.conf

After that you may need to restart your computer, or just the gpg-agent.

Jules
  • 1,275
  • 7
  • 12
  • What if I have no `gpg-agent.conf` file in my `~/.gnupg/` directory? Also: does `pinentry-emacs` hide asking password in minibuffer with asterisk symbols? – drobnbobn Mar 07 '16 at 17:01
  • 1
    You can create the file with only that inside of it. Yes it does! – Jules Mar 07 '16 at 17:02
  • It works for me! Now I can use minibuffer for that task! But now every time I start Emacs it shows error: `Warning (initialization): An error occurred while loading /home/user/.emacs: Symbol's function definition is void: pinentry-start`. What there may be the cause? – drobnbobn Mar 07 '16 at 17:23
  • Hm.. removing `(pinentry-start)` from `.emacs` file fixed this error. Also there there is no such line in documentation https://github.com/ecraven/pinentry-emacs. All is OK now! – drobnbobn Mar 07 '16 at 17:31
  • 1
    I think that `(pinentry-start)` should be built-into emacs if your version is sufficently new. Otherwise you can download it through elpa! Anyways I'm glad it works! – Jules Mar 07 '16 at 17:53