3

I'm trying to make PGP keys sharing from Windows 10 to WSL 2 with Ubuntu 20.04.

I'm using this tool: https://github.com/BlackReloaded/wsl2-ssh-pageant

My current situation is that with gpg-connect-agent 'keyinfo --list' /bye all my Windows GPG keys are listed, but with gpg --list-keys an empty list is returned.

$ gpg-connect-agent 'keyinfo --list' /bye
S KEYINFO 9BD09C... D - - - P - - -
S KEYINFO BBF58D... D - - - P - - -
S KEYINFO D62ED0... D - - - P - - -
OK

Signing attemps fails with 'No secret key', but I think this is spected, as gpg --list-keys are empty: echo "test" | gpg --sign -u mail@none.com

Any clues why is this happenning?

What is the relation with gpg and gpg-connect-agent?

Setup:

  1. Start a fresh WSL 2 session with `wsl --shutdown'
  2. Remove 'S.gpg-agent' file
  3. Create pipe with setsid socat UNIX-LISTEN:$GPG_AGENT_SOCK,fork EXEC:"${WSL_TOOLS}/wsl2-ssh-pageant.exe --gpg S.gpg-agent",nofork &
Claudio Weiler
  • 589
  • 2
  • 15

1 Answers1

1

You need to import your public key to WSL.

As stated here https://wiki.gnupg.org/AgentForwarding:

It is important to note that to work properly GnuPG on the remote system still needs your public keys.

Steps:

  1. On Windows, export your public key with gpg --export -a 'mail@none.com' > public.key;
  2. On WSL, import your public key with gpg --import public.key.
Claudio Weiler
  • 589
  • 2
  • 15
  • 1
    This would be a stronger answer if it described how to do so, to still be useful in the future even if the wiki link breaks. – Charles Duffy Nov 04 '21 at 16:44