gpg-preset-passphrase not working with 2.1

David Matthews davidmatthewslb at gmail.com
Wed Jul 6 08:25:00 CEST 2016


I can't get gpg-preset-passphrase to work with GnuPG 2.1.7. The
command appears to work successfully but the passphase is not found by
GET_PASSPHRASE. I've included details of my simple test below plus the
output from running it on Centos 7.2 (where it works using 2.0.22) and
Fedora 23 (where it fails using 2.1.7).

Searching through the issue tracker I found
https://bugs.gnupg.org/gnupg/issue2015. The title of this issue is
"GET_PASSPHRASE with --no-ask always return error in gnupg 2.1.5" but,
based on the discussion in the issue, I think the title is now wrong
and should really be "gpg-preset-passphrase does not work". Have I
understood that correctly? If so I assume I will see the same issue
with the latest release?

Any advice much appreciated.

Thanks

## Test script

#!/bin/bash
set -x
eval "$(gpg-agent -vv --daemon --allow-preset-passphrase --debug-level 9)"
/usr/libexec/gpg-preset-passphrase -vv --preset -P test myid
echo "GET_PASSPHRASE --no-ask myid Err Pmt Des" | gpg-connect-agent -vv

## Centos 7.2 output

++ gpg-agent -vv --daemon --allow-preset-passphrase --debug-level 9
gpg-agent[3239]: enabled debug flags: command mpi crypto memory cache
memstat assuan
gpg-agent[3239]: listening on socket `/home/vagrant/.gnupg/S.gpg-agent'
gpg-agent[3240]: gpg-agent (GnuPG) 2.0.22 started
+ eval 'GPG_AGENT_INFO=/home/vagrant/.gnupg/S.gpg-agent:3240:1; export
GPG_AGENT_INFO;'
++ GPG_AGENT_INFO=/home/vagrant/.gnupg/S.gpg-agent:3240:1
++ export GPG_AGENT_INFO
+ /usr/libexec/gpg-preset-passphrase -vv --preset -P test myid
gpg-agent[3240]: handler 0xcfcb70 for fd 7 started
gpg-agent[3240]: chan_7 -> OK Pleased to meet you, process 3241
gpg-agent[3240]: chan_7 <- OPTION display=localhost:10.0
gpg-agent[3240]: chan_7 -> OK
gpg-agent[3240]: chan_7 <- OPTION ttyname=/dev/pts/1
gpg-agent[3240]: chan_7 -> OK
gpg-agent[3240]: chan_7 <- OPTION ttytype=dumb
gpg-agent[3240]: chan_7 -> OK
gpg-agent[3240]: chan_7 <- OPTION lc-ctype=en_US.UTF-8
gpg-agent[3240]: chan_7 -> OK
gpg-agent[3240]: chan_7 <- OPTION lc-messages=en_US.UTF-8
gpg-agent[3240]: chan_7 -> OK
gpg-agent[3240]: chan_7 <- PRESET_PASSPHRASE myid -1 74657374
gpg-agent[3240]: DBG: agent_put_cache `myid' requested ttl=-1 mode=1
gpg-agent[3240]: chan_7 -> OK
gpg-agent[3240]: chan_7 <- [eof]
gpg-agent[3240]: handler 0xcfcb70 for fd 7 terminated
+ echo 'GET_PASSPHRASE --no-ask myid Err Pmt Des'
+ gpg-connect-agent -vv
gpg-agent[3240]: handler 0xcfe550 for fd 7 started
gpg-agent[3240]: chan_7 -> OK Pleased to meet you, process 3243
gpg-connect-agent: connection to agent established
gpg-agent[3240]: chan_7 <- RESET
gpg-agent[3240]: chan_7 -> OK
gpg-agent[3240]: chan_7 <- OPTION ttytype=dumb
gpg-agent[3240]: chan_7 -> OK
gpg-agent[3240]: chan_7 <- OPTION display=localhost:10.0
gpg-agent[3240]: chan_7 -> OK
gpg-agent[3240]: chan_7 <- GET_PASSPHRASE --no-ask myid Err Pmt Des
gpg-agent[3240]: DBG: agent_get_cache `myid'...
gpg-agent[3240]: DBG: ... hit
gpg-agent[3240]: chan_7 -> [[Confidential data not shown]]
OK 74657374
gpg-connect-agent: closing connection to agent

## Fedora 23 output

++ gpg-agent -vv --daemon --allow-preset-passphrase --debug-level 9
gpg-agent[1420]: enabled debug flags: command mpi crypto memory cache
memstat ipc
gpg-agent[1420]: listening on socket '/home/vagrant/.gnupg/S.gpg-agent'
gpg-agent[1421]: gpg-agent (GnuPG) 2.1.7 started
+ eval ''
+ /usr/libexec/gpg-preset-passphrase -vv --preset -P test myid
gpg-agent[1421]: handler 0x7f8092ffc700 for fd 4 started
gpg-agent[1421]: DBG: chan_4 -> OK Pleased to meet you, process 1422
gpg-agent[1421]: DBG: chan_4 <- OPTION ttyname=/dev/pts/1
gpg-agent[1421]: DBG: chan_4 -> OK
gpg-agent[1421]: DBG: chan_4 <- OPTION ttytype=dumb
gpg-agent[1421]: DBG: chan_4 -> OK
gpg-agent[1421]: DBG: chan_4 <- OPTION lc-ctype=en_US.UTF-8
gpg-agent[1421]: DBG: chan_4 -> OK
gpg-agent[1421]: DBG: chan_4 <- OPTION lc-messages=en_US.UTF-8
gpg-agent[1421]: DBG: chan_4 -> OK
gpg-agent[1421]: DBG: chan_4 <- PRESET_PASSPHRASE myid -1 74657374
gpg-agent[1421]: DBG: agent_put_cache 'myid' (mode 1) requested ttl=-1
gpg-agent[1421]: DBG: chan_4 -> OK
gpg-agent[1421]: DBG: chan_4 <- [eof]
gpg-agent[1421]: handler 0x7f8092ffc700 for fd 4 terminated
+ echo 'GET_PASSPHRASE --no-ask myid Err Pmt Des'
+ gpg-connect-agent -vv
gpg-agent[1421]: handler 0x7f8092ffc700 for fd 4 started
gpg-agent[1421]: DBG: chan_4 -> OK Pleased to meet you, process 1425
gpg-agent[1421]: DBG: chan_4 <- RESET
gpg-agent[1421]: DBG: chan_4 -> OK
gpg-agent[1421]: DBG: chan_4 <- OPTION ttytype=dumb
gpg-agent[1421]: DBG: chan_4 -> OK
gpg-agent[1421]: DBG: chan_4 <- OPTION putenv=INSIDE_EMACS=24.5.1,comint
gpg-agent[1421]: DBG: chan_4 -> OK
gpg-agent[1421]: DBG: chan_4 <- GET_PASSPHRASE --no-ask myid Err Pmt Des
gpg-agent[1421]: DBG: agent_get_cache 'myid' (mode 3) ...
gpg-agent[1421]: DBG: ... miss
gpg-agent[1421]: command 'GET_PASSPHRASE' failed: No data
gpg-agent[1421]: DBG: chan_4 -> ERR 67108922 No data <GPG Agent>
ERR 67108922 No data <GPG Agent>
gpg-connect-agent: closing connection to agent
gpg-agent[1421]: DBG: chan_4 <- [eof]
gpg-agent[1421]: handler 0x7f8092ffc700 for fd 4 terminated



More information about the Gnupg-users mailing list