Xiyue Deng <manp...@gmail.com> writes:

> On Mon, Dec 09, 2019 at 11:34:38AM +0100, Rudolf Sykora wrote:
>> Date: Mon, 09 Dec 2019 11:34:38 +0100
>> From: Rudolf Sykora <rsyk...@disroot.org>
>> To: Stefan Hagen <sh+open...@codevoid.de>, OpenBSD Misc Mailing List
>>  <misc@openbsd.org>
>> Cc: Pierre-Emmanuel Andre <p...@openbsd.org>
>> Subject: Re: pinentry-tty in OpenBSD? to be used with emacs
>>
>>
>> rsyk...@disroot.org writes:
>>
>> December 8, 2019 5:45 PM, "Stefan Hagen" <sh+open...@codevoid.de> wrote:
>>
>> > Stefan Hagen wrote:
>> >
>> >> Rudolf Sykora wrote:
>> >>> On linux, I believe, there is a pinentry-tty program, but that one is
>> >>> not available on OpenBSD.
>> >>
>> >> Have you tried pinentry-curses? I'm using it on my remote machines
>> >> to decrypt passwords in my password-store. Works well so far.
>> >
>> >> Well, the attached patch enables pinentry-tty in security/pinentry.
>>
>> I tried pinentry-curses. Now I was able to try pinentry-tty,
>> too. However, with both I apparently have the same problem. The prompt
>> for passphrase is just thrown somewhere into the emacs window, and I am
>> not able to enter the password (emacs most probably doesn't know about
>> the request for passphrase, it tries to interpret keypresses as commands).
>>
>> I even tried to enable pinentry-emacs in the pinentry Makefile; it
>> is built. But when I choose it for the pinentry-program in
>> ~/.gnupg/gpg-agent.conf, at the moment when the passphrase should be
>> entered, I get the message
>> gpg: problem with the agent: No pinentry.
>>
>>
>> Thanks for any more help.
>>
>> Ruda
>>
>
> You can try to add "allow-emacs-pinentry" to your gpg-agent.conf and
> reconnect gpg-agent and retry.
>
> Relevant discussion on Reddit:
> https://www.reddit.com/r/emacs/comments/68xtx1/reliable_way_of_setting_up_gpg_password_input_in/dh2ozi2?utm_source=share&utm_medium=web2x

Thanks for the link. Although it didn't help, I finally, by trial and
error, got my emacs to ask for the passphrase. In my case, I changed
~/.gnupg/gpg-agent.conf to just have:

allow-emacs-pinentry

inside, and in my .emacs I have:

(setenv "INSIDE_EMACS" (format "%s,comint" emacs-version))
(pinentry-start)

I have installed the pinentry package from M-x list-packages.  And then
(after
pkill emacs gpg-agent
) emacs started to ask me as I wanted.  I note that compiling and
installing the pinentry-emacs (or pinentry-tty) within the pinentry port
seems unnecessary. Furthermore, both lines in my .emacs seem to be
essential.  It's a pity I still do not understand how the chain really
works, but at least it works somehow now.

Hope it might help somebody in the future. I lost many hours with
such a trivial thing.


Best regards
Ruda

Reply via email to