Skip to content

Instantly share code, notes, and snippets.

@skulumani
Last active October 21, 2018 19:15
Show Gist options
  • Save skulumani/9b839df5b3774956dc562a46a666395f to your computer and use it in GitHub Desktop.
Save skulumani/9b839df5b3774956dc562a46a666395f to your computer and use it in GitHub Desktop.
PGP Public Keys

To move to a new system

  • Install dependencies
sudo apt-get install -y gnupg2 gnupg-agent scdaemon pcscd

or for MacOS

brew install gnupg pinentry-mac
curl https://keybase.io/skulumani/pgp_keys.asc?fingerprint=5dc0e5c9ad73dc63d61d744520d0685093466fc7 | gpg --import
export KEYID=0x20D0685093466FC7
  • Move public ssh key to store (Git and Bitbucket are setup with this public key)
curl https://gist.github.com/skulumani/9b839df5b3774956dc562a46a666395f/raw/c9324839f6d08c9402e392898ab066deba176a90/id_rsa_yubikey.pub > ~/.ssh/id_rsa_yubikey.pub

*. Insert and get data from yubikey

gpg --card-status
  • Encryption
echo "test message string" | gpg --encrypt --armor --recipient $KEYID > /tmp/test.txt
  • Decryption
gpg --decrypt --armor /tmp/test.txt
  • Signing
echo "test message string" | gpg --armor --clearsign --default-key $KEYID

SSH onto remote server which has public ssh key

ssh -i ~/.ssh/id_rsa_yubikey.pub name@server

Additional help

https://github.com/drduh/YubiKey-Guide

https://gist.github.com/ageis/14adc308087859e199912b4c79c4aaa4

Secrets live on Yubikey

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDEwkZSQyNoitjG0AqkppO3MBvvIRmsquGFau/GcRBSb88YRfIy3jppqfEIyW1FKqAZ8xUW+FN8q5KZ6obce+zEfnn2hwiENanIx3jXZAqD5/RQctezY7f8zbLyBV99ikPirfqS3RABIcL88VAZKesYTj5FihsuUQ5UxJCzIhpHp9Glin90i6ojS9TimT9ZZjTp0PoUw67D5pnlnh5uhuxo72tkNx8ezyT3e4Rw9hYEVeX2gHrxoMr2LgsievBmun1fcliB+PZtv+qnJQlP988hwNYFynE2LnCsB+DAOsbk9tkpI1gYEJv4MLMUfI2cobfYRhBVJXq/jT1WdlzdbE/0AqwhD4InPN6Zs40mmLN8Wy4BHDxgCkLXxrlPkZqS39nthXu0rPxDmcEvsHHeVw9iZKVQJDgLp2KEksDkfz0t6citx1Wd5dYe7uczoqOLqGmKSOh/X10VFZmV04+kJxpYU8OUd82Waw9dVcwFvSsLYjPooXWhdlpZL+7N8QasbuAJBwEkcQLbeHNX6Etl5Q6m8iW5VKMvCyoLcaPYJIPMaoyZDaqFlH8P5s8SPKEgwYSg6Y8CFh8UdcT45k3Y8ZGAMkqQkzZ+trGlI4T/JfN15yc+XHAovwkIin16+xaiXCj2szGzswWBI+C6Tq6aeKovxvG9O/Shy87R3fIFmQWIAw== cardno:000607761351
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment