pinentry-curses and gpg-agent ipc write error

Adam Richards adam at avertech.net
Tue Aug 28 01:24:24 CEST 2007


Hi.

I'm trying to get pinentry-curses (0.7.2_6) to work with gpg and
gpg-agent (v2.0.4).  Both installed via /usr/ports on
FreeBSD-RELEASE, default Makefile options.  But it is not
working.

When I enter my passphrase in the pinentry-curses dialog, the
response is:


----------------------------------------------------------------
gpg: problem with the agent: IPC write error
gpg: Invalid passphrase; please try again ...

You need a passphrase to unlock the secret key for
user: "<adam at avertech.net>"
4096-bit ELG key, ID AEXXXXXX, created 2005-11-25 (main key ID
0BA2643B)

gpg: problem with the agent: IPC write error
gpg: encrypted with 4096-bit ELG key, ID AEXXXXXX, created
2005-11-25
      "<adam at avertech.net>"
gpg: public key decryption failed: General error
gpg: decryption failed: No secret key
----------------------------------------------------------------


Pinentry is indeed linked to pinentry-curses, my
~/.gnupg/gpg-agent.conf is setup correctly, and I'm using
`use-agent' directive in ~/.gnupg/gpg.conf:


----------------------------------------------------------------
~> pwd
/usr/local/bin
~> ll pinentry
[...] pinentry@ -> pinentry-curses

~> cat ~/.gnupg/gpg-agent.conf 
default-cache-ttl 3600
pinentry-program /usr/local/bin/pinentry
debug-level guru
debug-all

~> grep use-agent ~/.gnupg/gpg.conf 
use-agent
----------------------------------------------------------------


I know I have the correct passphrase because when I use a
different pinentry, it works just fine:


----------------------------------------------------------------
~> pwd
/usr/local/bin

~> ll pinentry
[...] pinentry@ -> pinentry-gtk

~> gpg -v sample.txt.gpg
[... gtk dialog comes up and I enter passphrase, hit OK ...]
gpg: public key is AEXXXXXX
gpg: using subkey AEXXXXXX instead of primary key 0BA2643B

You need a passphrase to unlock the secret key for
user: "<adam at avertech.net>"
gpg: using subkey AEXXXXXX instead of primary key 0BA2643B
4096-bit ELG key, ID AEXXXXXX, created 2005-11-25 (main key ID
0BA2643B)

gpg: encrypted with 4096-bit ELG key, ID AEXXXXXX, created
2005-11-25
      "<adam at avertech.net>"
gpg: AES256 encrypted data
gpg: original file name='sample.txt'
----------------------------------------------------------------


And yes, I do remember to kill -HUP gpg-agent when needed.

I initiate gpg-agent from my ~/.zshrc:


----------------------------------------------------------------
[...]
# {{{ gpg-agent automation
if [[ -f $HOME/.gpg-agent-info ]] &&
	kill -0 `cut -d: -f 2 $HOME/.gpg-agent-info` 2>/dev/null;
	then
		echo 'GPG-AGENT CURRENTLY RUNNING, UPDATING ENV...'
		GPG_AGENT_INFO=`cat $HOME/.gpg-agent-info`
		export GPG_AGENT_INFO
		echo 'GPG-AGENT ENV REFRESHED.'
	else
		echo '...STARTING GPG-AGENT'
		eval `/usr/local/bin/gpg-agent --daemon`
		echo $GPG_AGENT_INFO >$HOME/.gpg-agent-info
		echo 'GPG-AGENT READY.'
fi
# }}}
[...]

~> /bin/ps x | grep gpg-agent
89498  ??  Ss     0:00.36 /usr/local/bin/gpg-agent --daemon

~> sockstat | grep gpg-agent
adam gpg-agent  89498 6  stream /tmp/gpg-GqplAN/S.gpg-agent
----------------------------------------------------------------


And I believe my ENV is correct:


----------------------------------------------------------------
~> cat /tmp/gpg-GqplAN/S.gpg-agent
OK Pleased to meet you

~> env | grep GPG
GPG_AGENT_INFO=/tmp/gpg-GqplAN/S.gpg-agent:89498:1
GPG_TTY=/dev/ttypm

~> tty
/dev/ttypm
----------------------------------------------------------------


Any help would be greatly appreciated.  :)  I haven't had much
luck googling around.  I do not want to use a graphical-based
pinentry because I'm running xterm only over ssh session and I'm
not interested in X forwarding.

Thanks!

-- 
Adam Richards
e:adam at avertech.net | k:0x0BA2643B



More information about the Gnupg-users mailing list