You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reacted by Vlastimil Ovčáčík, Liqueur Librazy, John Boehr, Mikey Lombardi (He/Him), Gunni, Cole Mickens, Paweł Weselak, Patrick McNamara, Reza Tavakoli, Morgan Courbet and 20 more
Manoj Ampalam (@manojampalam) yes, the gpg-agent creates S.gpg-agent.ssh file with TCP port number it listens on and authorization cookie. I believe this way it is compatible with cygwin environment, but unfortunately not with this project (that is using named pipes).
When you get to it, make sure you work with the official Windows builds available from gpg ftp (ftp://ftp.gnupg.org/gcrypt/binary/). It is far more superior than Gpg4win, but it is bit hidden out of sight and not advertised at all.
Vlastimil Ovčáčík (@vovcacik) your understanding is correct. On Windows the logical equivalent of Unix Domain Sockets is named pipes (that inherently provides authorization capabilities). We unfortunately have no alternative way to use smartcards with this version of OpenSSH. Its a feature that we need to implement for Windows.
You'll have to stick with Cygwin for now (if it works).
Given that UNIX domain sockets are pretty similar to Windows named pipes, I wonder if it'd be possible to create a program that sets up a named pipe that gets assigned to $SSH_AUTH_SOCK and then proxies between that and the socket set up by gpg-agent. I have a couple of concerns about that, though:
Is the protocol used by ssh-agent over named pipes byte-for-byte the same as for ssh-agent over domain sockets? That is, are there endianness issues that need to be considered, or a need to translate between gpg-agent's ssh-agent protocol implementation and Win32-OpenSSH's?
The socket files created by gpg-agent on Windows may match the structure used by Cygwin or MSYS, but don't necessarily do so. For example, on my machine right now S.gpg-agent.ssh only includes a 16-byte cookie, rather than the Cygwin socket header and port number.
Vlastimil Ovčáčík (@vovcacik) what version of GPG do you have installed, and is it a Cygwin or MSYS build? They each have their own format for the sock file (or more than one possible format), all of which would need to be supported.
Vlastimil Ovčáčík (@vovcacik) Gpg4win uses the "official native build" as you put it. Could you update to 2.2.3 and see what the socket file looks like afterwards?
Coming back to this on a Windows 11 22H2 machine, I now get what others have been experiencing "invalid format" resulting from ssh-add -L when using SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
I observe, similarly to Kaylyn Bogle (@kaylynb) , the \\.\pipe\openssh-ssh-agent socket is not created by gpg-agent.
I observe that gpgconf --list-dirs agent-ssh-agent shows the AppData\Local\gnupg\S.gpg-agent.ssh location.
ssh -V
OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3
UPDATE
I've tried using what previously worked for me in #827 (comment) but now get
gpg --version
gpg (GnuPG) 2.4.0
libgcrypt 1.10.1
Copyright (C) 2021 g10 Code GmbH
License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: C:\Users\MichaelKiwiNgarimu\AppData\Roaming\gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
gpgconf -V
* GnuPG 2.4.0 (c0556edb8)
MingW32
Windows 10.0 build 22621
* Libgcrypt 1.10.1 (ae0e5678)
version:1.10.1:10a01:1.46:12e00:
cc:80300:gcc:8.3-win32 20190406:
ciphers:arcfour:blowfish:cast5:des:aes:twofish:serpent:rfc2268:seed:camellia:idea:salsa20:gost28147:chacha20:sm4:
pubkeys:dsa:elgamal:rsa:ecc:
digests:crc:gostr3411-94::md4:md5:rmd160:sha1:sha256:sha512:sha3:tiger:whirlpool:stribog:blake2:sm3:
rnd-mod:w32:
cpu-arch:x86:
mpi-asm:i386/mpih-add1.S:i386/mpih-sub1.S:i386/mpih-mul1.S:i386/mpih-mul2.S:i386/mpih-mul3.S:i386/mpih-lshift.S:i386/mpih-rshift.S:
hwflist:intel-cpu:intel-bmi2:intel-ssse3:intel-sse4.1:intel-pclmul:intel-aesni:intel-rdrand:intel-avx:intel-avx2:intel-fast-vpgather:intel-rdtsc:intel-shaext:intel-vaes-vpclmul:
fips-mode:n:::
rng-type:standard:1:3030000:1:
compliance:::
* GpgRT 1.46 (ea03187)
* Libassuan 2.5.5 (f8cfb56)
* KSBA 1.6.3 (bffa9b3)
* NTBTLS 0.3.1 (802494e)
OpenSSH
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'
Name : OpenSSH.Client~~~~0.0.1.0
State : Installed
Name : OpenSSH.Server~~~~0.0.1.0
State : NotPresent
ssh -V
OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3
Have you stopped the openssh ssh-agent Windows service?
PS> Get-Service ssh-agent
Status Name DisplayName
------ ---- -----------
Stopped ssh-agent OpenSSH Authentication Agent
Have you ensured that gpg-agent is running?
PS> gpg-connect-agent "killagent" /bye
OK closing connection
PS> gpg-connect-agent /bye
gpg-connect-agent: no running gpg-agent - starting 'C:\\Program Files (x86)\\GnuPG\\bin\\gpg-agent.exe'
gpg-connect-agent: waiting for the agent to come up ... (5s)
gpg-connect-agent: connection to the agent established
If you're still not seeing any keys output from ssh-add -L then try getting gpg-agent logs (see my earlier comment above). The same comment lists the errors that I encountered and how I resolved them. I hope some of this helps you.
I think "5" relates to a Windows HRESULT "ERROR_ACCESS_DENIED". I saw that error when I was running gpg-agent with elevated privileges. Are you running gpg-agent with elevated privileges, or as administrator?
Eh, I think I met a other question.
When I type ssh-add -L, the error message The agent has no identities and the correct message ssh-sth here (none) appear alternately.
My Environment:
Windows 11 22H2 (OS 22621.1702)
gpg-agent run as Administrator
PS> gpg --version
gpg (GnuPG) 2.4.0
libgcrypt 1.10.1
Copyright (C) 2021 g10 Code GmbH
License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: C:\Users\Me\AppData\Roaming\gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
PS> gpgconf -V
* GnuPG 2.4.0 (c0556edb8)
MingW32
Windows 10.0 build 22621
* Libgcrypt 1.10.1 (ae0e5678)
version:1.10.1:10a01:1.46:12e00:
cc:80300:gcc:8.3-win32 20190406:
ciphers:arcfour:blowfish:cast5:des:aes:twofish:serpent:rfc2268:seed:camellia:idea:salsa20:gost28147:chacha20:sm4:
pubkeys:dsa:elgamal:rsa:ecc:
digests:crc:gostr3411-94::md4:md5:rmd160:sha1:sha256:sha512:sha3:tiger:whirlpool:stribog:blake2:sm3:
rnd-mod:w32:
cpu-arch:x86:
mpi-asm:i386/mpih-add1.S:i386/mpih-sub1.S:i386/mpih-mul1.S:i386/mpih-mul2.S:i386/mpih-mul3.S:i386/mpih-lshift.S:i386/mpih-rshift.S:
hwflist:intel-bmi2:intel-ssse3:intel-sse4.1:intel-pclmul:intel-aesni:intel-rdrand:intel-avx:intel-avx2:intel-rdtsc:intel-shaext:intel-vaes-vpclmul:
fips-mode:n:::
rng-type:standard:1:3030000:1:
compliance:::
* GpgRT 1.46 (ea03187)
* Libassuan 2.5.5 (f8cfb56)
* KSBA 1.6.3 (bffa9b3)
* NTBTLS 0.3.1 (802494e)
PS> ssh -V
OpenSSH_for_Windows_9.2p1, LibreSSL 3.7.2
PS> Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'
Name : OpenSSH.Client~~~~0.0.1.0
State : NotPresent
Name : OpenSSH.Server~~~~0.0.1.0
State : NotPresent
PS> echo $env:SSH_AUTH_SOCK
\\.\pipe\openssh-ssh-agent
Eh, I think I met a other question. When I type ssh-add -L, the error message The agent has no identities and the correct message ssh-sth here (none) appear alternately.
...
I want to add that if you encounter the issue ssh request identities failed: Line too long <GPG Agent>, make sure that sshcontrol (In my case c:/Users/USER/AppData/Roaming/gnupg/sshcontrol) ends with unix-end line \n. Even if it contains just a single keygrip, it should have new-line character at the end.
Reference: https://github.com/gpg/gnupg/blob/9adaa79ab43e2f87178b8ee5ab1a353cba384606/g10/tdbdump.c#L160-L161
Reacted by Michele Perrotta, Michael "Kiwi" Ngarimu and hilorioze
gpg --version
gpg (GnuPG) 2.4.0
libgcrypt 1.10.1
Copyright (C) 2021 g10 Code GmbH
License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: C:\Users\MichaelKiwiNgarimu\AppData\Roaming\gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
gpgconf -V
* GnuPG 2.4.0 (c0556edb8)
MingW32
Windows 10.0 build 22621
* Libgcrypt 1.10.1 (ae0e5678)
version:1.10.1:10a01:1.46:12e00:
cc:80300:gcc:8.3-win32 20190406:
ciphers:arcfour:blowfish:cast5:des:aes:twofish:serpent:rfc2268:seed:camellia:idea:salsa20:gost28147:chacha20:sm4:
pubkeys:dsa:elgamal:rsa:ecc:
digests:crc:gostr3411-94::md4:md5:rmd160:sha1:sha256:sha512:sha3:tiger:whirlpool:stribog:blake2:sm3:
rnd-mod:w32:
cpu-arch:x86:
mpi-asm:i386/mpih-add1.S:i386/mpih-sub1.S:i386/mpih-mul1.S:i386/mpih-mul2.S:i386/mpih-mul3.S:i386/mpih-lshift.S:i386/mpih-rshift.S:
hwflist:intel-cpu:intel-bmi2:intel-ssse3:intel-sse4.1:intel-pclmul:intel-aesni:intel-rdrand:intel-avx:intel-avx2:intel-fast-vpgather:intel-rdtsc:intel-shaext:intel-vaes-vpclmul:
fips-mode:n:::
rng-type:standard:1:3030000:1:
compliance:::
* GpgRT 1.46 (ea03187)
* Libassuan 2.5.5 (f8cfb56)
* KSBA 1.6.3 (bffa9b3)
* NTBTLS 0.3.1 (802494e)
OpenSSH
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'
Name : OpenSSH.Client~~~~0.0.1.0
State : Installed
Name : OpenSSH.Server~~~~0.0.1.0
State : NotPresent
ssh -V
OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3
Activity
bagajjal commentedon Jul 27, 2017
As of now, we don't support this scenario. This will be added to our backlog and will be picked based on the priority.
manojampalam commentedon Aug 1, 2017
Is gpg-agent listening on a network socket?
vovcacik commentedon Aug 12, 2017
Manoj Ampalam (@manojampalam) yes, the gpg-agent creates
S.gpg-agent.sshfile with TCP port number it listens on and authorization cookie. I believe this way it is compatible withcygwinenvironment, but unfortunately not with this project (that is using named pipes).vovcacik commentedon Aug 12, 2017
bagajjal I understand, thanks.
When you get to it, make sure you work with the official Windows builds available from gpg ftp (
ftp://ftp.gnupg.org/gcrypt/binary/). It is far more superior than Gpg4win, but it is bit hidden out of sight and not advertised at all.[-]Recommendation for GPG and smartcard users[/-][+]Support GPG and smartcard users[/+]manojampalam commentedon Aug 14, 2017
Vlastimil Ovčáčík (@vovcacik) your understanding is correct. On Windows the logical equivalent of Unix Domain Sockets is named pipes (that inherently provides authorization capabilities). We unfortunately have no alternative way to use smartcards with this version of OpenSSH. Its a feature that we need to implement for Windows.
You'll have to stick with Cygwin for now (if it works).
charabaruk commentedon Dec 7, 2017
Given that UNIX domain sockets are pretty similar to Windows named pipes, I wonder if it'd be possible to create a program that sets up a named pipe that gets assigned to
$SSH_AUTH_SOCKand then proxies between that and the socket set up by gpg-agent. I have a couple of concerns about that, though:vovcacik commentedon Dec 7, 2017
My
S.gpg-agent.sshcontains port number and 16 byte cookie. I am usingftp://ftp.gnupg.org/gcrypt/binary/.charabaruk commentedon Dec 7, 2017
Vlastimil Ovčáčík (@vovcacik) what version of GPG do you have installed, and is it a Cygwin or MSYS build? They each have their own format for the sock file (or more than one possible format), all of which would need to be supported.
vovcacik commentedon Dec 7, 2017
@coldacid it is neither Cygwin-based, MSYS-based nor Gpg4win, but rather official native build.
charabaruk commentedon Dec 7, 2017
Vlastimil Ovčáčík (@vovcacik) Gpg4win uses the "official native build" as you put it. Could you update to 2.2.3 and see what the socket file looks like afterwards?
manojampalam commentedon Dec 7, 2017
Protocol used by Windows version of ssh-agent is the same as in Unix. So a named pipe to network sock interop adapter should work for your case.
charabaruk commentedon Dec 7, 2017
Manoj Ampalam (@manojampalam) excellent. I'll take some time this weekend to prototype one out.
84 remaining items
thxkiwi commentedon Feb 10, 2023
Coming back to this on a Windows 11 22H2 machine, I now get what others have been experiencing "invalid format" resulting from ssh-add -L when using
SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)I observe, similarly to Kaylyn Bogle (@kaylynb) , the
\\.\pipe\openssh-ssh-agentsocket is not created by gpg-agent.I observe that
gpgconf --list-dirs agent-ssh-agentshows theAppData\Local\gnupg\S.gpg-agent.sshlocation.UPDATE
I've tried using what previously worked for me in #827 (comment) but now get
thxkiwi commentedon Feb 11, 2023
My Windows 11 22H2 Issues Resolved
Software Installed
gpg.conf
None
gpg-agent.conf
sshcontrol
Created using the output from
Copy and paste the key grip of the authentication key into the file. Include a newline after the 40-byte key grip ID.
Running gpg-agent
gpg-connect-agent /byeas your userErrors and How I Resolved Them
access denied
gpg-agent/gpg-connect-agentelevatedinvalid format
$(gpgconf --list-dirs agent-ssh-socket)$env:SSH_AUTH_SOCK="\\.\pipe\openssh-ssh-agentagent refused operation
gpg-agent.logshows2023-02-11 03:33:59 gpg-agent[14932] ssh request identities failed: Line too long <GPG Agent>sshcontrolusingecho <value> >> sshcontrolsshcontrolj1g5awi commentedon Mar 17, 2023
My Issues Resolved
DISABLE the openssh ssh-agent Windows service IS IMPORTANT
Kirill Belousov (@cyrmax) Anon-4 SamJakob (@SamJakob) Have you slove this problem ?
I have met the same problem, get
The agent has no identities.fromssh-add -lany way, I think I need some help.There is my env below:
Windows 11
22H2 22621.1413
GPG
gpg-agent.conf
OpenSSH
OpenSSH_for_Windows_9.2p1, LibreSSL 3.6.1
thxkiwi commentedon Mar 23, 2023
Jigsaw (@j1g5awi)
If you're still not seeing any keys output from
ssh-add -Lthen try gettinggpg-agentlogs (see my earlier comment above). The same comment lists the errors that I encountered and how I resolved them. I hope some of this helps you.j1g5awi commentedon Mar 24, 2023
Michael Ngarimu (@thxkiwi) Thanks your help!
I got logs below:
Do you know what does it mean?
thxkiwi commentedon Mar 24, 2023
I think "5" relates to a Windows HRESULT "ERROR_ACCESS_DENIED". I saw that error when I was running gpg-agent with elevated privileges. Are you running gpg-agent with elevated privileges, or as administrator?
j1g5awi commentedon Mar 24, 2023
I just install gpg4win from their offical website, and open the Kleopatra in Desktop icon, and never see any prompt for elevating privilege.
char-46 commentedon May 23, 2023
Eh, I think I met a other question.
When I type
ssh-add -L, the error messageThe agent has no identitiesand the correct messagessh-sth here (none)appear alternately.My Environment:
Windows 11 22H2 (OS 22621.1702)
gpg-agent run as Administrator
gpg.conf
gpg-agent.conf
keygrip from
gpg --list-secret-keys --with-keygripis in sshcontrolnamelessmasses commentedon May 27, 2023
I would see that error if I was running gpg-agent or gpg-connect-agent elevated.
namelessmasses commentedon May 27, 2023
Does the pipe exist?
Have you checked the logs for any errors?
Is this file formatted correctly? I found sshcontrol to be quite finicky. Check the file contents against the documented format for sshcontrol (https://www.gnupg.org/documentation/manuals/gnupg/Agent-Configuration.html)
piotrpdev commentedon Jan 27, 2024
Thanks for this, I stopped the service and it fixed my issues :)
It was also set to "Automatic" startup for some reason so I disabled it.
lislon commentedon May 29, 2024
I want to add that if you encounter the issue
ssh request identities failed: Line too long <GPG Agent>, make sure thatsshcontrol(In my casec:/Users/USER/AppData/Roaming/gnupg/sshcontrol) ends with unix-end line\n. Even if it contains just a single keygrip, it should have new-line character at the end.Reference: https://github.com/gpg/gnupg/blob/9adaa79ab43e2f87178b8ee5ab1a353cba384606/g10/tdbdump.c#L160-L161
bencejuhaasz commentedon Sep 17, 2024
I followed the guide, but I get
after setting $env:SSH_AUTH_SOCK="\.\pipe\openssh-ssh-agent"
RainCat1998 commentedon Oct 13, 2024
Yes, all you need is DISABLE the openssh ssh-agent Windows service.
kolade-ogunleye commentedon Apr 5, 2025
This is a lifesaver in 2025.