Skip to content

Instantly share code, notes, and snippets.

@andreadellacorte
Forked from cshtdd/keybase-to-rsa.sh
Last active August 27, 2017 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreadellacorte/03031ab6e20fe437a5a39605da5f20ea to your computer and use it in GitHub Desktop.
Save andreadellacorte/03031ab6e20fe437a5a39605da5f20ea to your computer and use it in GitHub Desktop.
#!/bin/zsh
echo "Start Export Process"
echo "Log into Keybase..."
keybase login
echo "Exporting your PGP keys..."
keybase pgp export -o keybase.public.key
keybase pgp export -s -o keybase.private.key
echo "Importing your Keybase keys..."
gpg -q --import keybase.public.key
gpg -q --allow-secret-key-import --import keybase.private.key
gpg --list-keys
read -p 'Key: ' key
mkdir ~/.ssh
gpg --export "$key" | openpgp2ssh "$key" > ~/.ssh/id_rsa.pub
gpg --export-secret-key "$key" | openpgp2ssh "$key" > ~/.ssh/id_rsa
chmod 400 ~/.ssh/id_rsa
echo "Cleaning up..."
rm *.key
echo "Success"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment