Skip to content

Instantly share code, notes, and snippets.

@ShaneDelmore
Forked from cshtdd/keybase-to-rsa.sh
Last active December 18, 2017 02:14
Show Gist options
  • Save ShaneDelmore/a93e355a60abe75e1aa38d36b1302f9b to your computer and use it in GitHub Desktop.
Save ShaneDelmore/a93e355a60abe75e1aa38d36b1302f9b 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..."
pubId=$(gpg1 --output --import keybase.public.key | grep 'pub' | cut -d' ' -f3 | cut -d'/' -f2)
gpg1 --output --allow-secret-key-import --import keybase.private.key 2>&1 | grep CD4 | cut -d' ' -f3 | cut -d':' -f1
privId=$(gpg1 --list-secret-key $pubId | grep ssb | cut -d' ' -f4 | cut -d'/' -f2)
echo "Generating RSA keys..."
gpg1 --export-options export-reset-subkey-passwd,export-minimal,no-export-attributes --export-secret-subkeys --no-armor 0x$privId! | openpgp2ssh $privId > 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