Skip to content

Instantly share code, notes, and snippets.

@javiergomezz
Forked from cshtdd/keybase-to-rsa.sh
Created September 22, 2017 09:42
Show Gist options
  • Save javiergomezz/895d0945b85df6c1aff6bf8790b0055a to your computer and use it in GitHub Desktop.
Save javiergomezz/895d0945b85df6c1aff6bf8790b0055a to your computer and use it in GitHub Desktop.
#!/bin/bash
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 | grep '^pub\s*.*\/*.\s.*' | grep -oEi '\/(.*)\s' | cut -c 2- | awk '{$1=$1};1' > hash.key
echo "Generating RSA keys..."
gpg --export-options export-reset-subkey-passwd,export-minimal,no-export-attributes --export-secret-keys --no-armor `cat hash.key` | openpgp2ssh `cat hash.key` > id_rsa
chmod 400 id_rsa
ssh-keygen -y -f id_rsa > id_rsa.pub
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