2

I have a Yubikey 4C Nano that I use with Linux and MacOS without issue. Recently, I installed a version of Windows on my macbook pro that allows me to dual-boot (so I can run the windows version of our application).

I installed the necessary requirements for Yubikey to use through git, namely GPG4Win. After rebooting, if I launch Kleopatra, select Tools -> Manage Smartcards, it doesn't show an entry for my smart card until I hit F5 to refresh.

If I don't perform this process of refreshing, my key also is not recognized in gitbash. BUT, once I perform this step, it is recognized and I can use it for the rest of the session.

My question is whether there is a way to script this so that I don't have to do this manual process every time I boot into Windows?

jwir3
  • 391
  • 2
  • 7
  • 17

1 Answers1

0

I realized that cmd.exe and msys were actually using two different versions of gpg.

From msys:

$ gpg --version
gpg (GnuPG) 2.2.18-unknown
libgcrypt 1.8.5
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 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/scottj/.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

From within cmd.exe:

gpg --version
gpg (GnuPG) 2.2.17
libgcrypt 1.8.4
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 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/scottj/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

Aside from not starting the gpg-agent, I was also unable to run gpg --card-status from within msys and get any output.

To fix this issue, I went into /usr/bin within msys and removed these files:

gpg.exe
gpg-connect-agent.exe
gpg-agent.exe
gpgconf.exe
gpg-error.exe
gpgparsemail.exe
gpgscm.exe
gpg-sm.exe
gpgtar.exe
gpgv.exe
gpg-wks-server.exe

(Or, more accurately, moving them to another location so you don't lose them, in the event that this backfires)

After doing this, gpg --card-status works within msys/Git Bash.

jwir3
  • 391
  • 2
  • 7
  • 17