Skip to content

Instantly share code, notes, and snippets.

@bannsec
Last active December 24, 2017 22:33
Show Gist options
  • Save bannsec/829e6f91bac5fa6dd03f1c636b5ae5af to your computer and use it in GitHub Desktop.
Save bannsec/829e6f91bac5fa6dd03f1c636b5ae5af to your computer and use it in GitHub Desktop.
Couple commands to export your ssh-key from a yubikey
# Assuming you already generated the private key using some other method, this will extract and create a ssh-key OpenSSH format that can be used for authenticating to openssh.
# This is most useful for ECC keys for right now, as ssh-keygen does not read it correctly.
# Lists out what keys you have on the device. Note the "ID" of the key you want
pkcs15-tool --list-public-keys
# Dump it out
pkcs15-tool --read-public-key <id> > my_key.pub
# Convert it to openssh format
ssh-keygen -i -m PKCS8 -f my_key.pub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment