Skip to content

Instantly share code, notes, and snippets.

@DzeryCZ
Created September 14, 2018 09:06
Show Gist options
  • Save DzeryCZ/b7de750cf4949a1ec4d562a687e98577 to your computer and use it in GitHub Desktop.
Save DzeryCZ/b7de750cf4949a1ec4d562a687e98577 to your computer and use it in GitHub Desktop.
How to use YubiKey On Windows

How to make GPG agent restart with every connection of YubiKey:

GPG agent sometimes stuck when you put your PC to sleep mode or when you unplug and plug your YubiKey back. This Solution will restart the GPG agent with every connection of YubiKey.

  • Create a "yubi-reset.bat" file on your disk and put there this content:
gpg-connect-agent killagent /bye
gpg-connect-agent /bye
  • Open Event Viewer
  • Go to Windows Logs → System
  • Connect YubiKey and refresh the list, you should see info event with source "WudfUsbccidDrv"
  • Right click this event and select "Attach Task To This Event"
  • Go thru the wizard and on "Start a Program" step enter path to your "yubi-reset.bat" file
  • That's it. Now whenever you connect your YubiKey, the GPG agent will be restarted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment