Using GPGAgent as SSHAgent on Windows with cygwin/mingw

Werner Koch wk at
Sat Sep 24 20:40:26 CEST 2016

On Sat, 24 Sep 2016 14:10, felix at said:

> which seems to me to be a process ID + binary data. So the socket
> appears to be there and it is recreated when I restart gpg-agent.

On Windows an emulation of Unix Domain Sockets is used by putting a
cookie and a port number into a plain file which is then used by the
client to to a local TCP connection to that port and check the cookie.

The way Cygwin does that is different from the way GnUPG does that.
IIRC, Cygwin added the cookie only later.  Thus the Unix emulated ssh
(using the Cyrwin dll) can't connect to native Windows program

We have code in libassuan/src/assuan-socket.c to cope with the Cygwin
socket emulation code (see below).  However, that code was never tested
by me and in fact implemented in blind flight mode.



commit 6d4a8ee2a6c749eec70bd3ae804f21456e375727
Author: Werner Koch <wk at>
Date:   Tue Jun 30 16:24:52 2015 +0200

    Support Cygwin local sockets.
    * src/assuan-socket.c (cygwin_fdtable, cygwin_fdtable_cs): New.
    (is_cygwin_fd, insert_cygwin_fd, delete_cygwin_fd): New.
    (assuan_sock_init) [W32]: Init the CS.
    (assuan_sock_deinit) [W32]: Deinit the CS.
    (read_port_and_nonce): Add arg cygwin and detect Cygwin socket files.
    (_assuan_sock_set_flag): Add "cygwin" flag.
    (_assuan_sock_get_flag): Ditto.
    (do_readn, do_writen): New.
    (_assuan_sock_bind): Create a Cygwin socket file depending on a socket
    (_assuan_sock_connect): Handle the cygwin socket protocol.
    (_assuan_sock_check_nonce): Ditto.
    This code has not been tested.
    Signed-off-by: Werner Koch <wk at>

Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 162 bytes
Desc: not available
URL: </pipermail/attachments/20160924/d9e71076/attachment.sig>

More information about the Gnupg-users mailing list