-
-
Save nillia/cb9e2164cc50896d16a1e5ac4d9e0933 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
HASH=$(gpg --list-keys | grep -A1 '^pub\s*.*\/*.\s.*' | tail -n 1 | sed -e 's/^[ \t]*//') | |
# We clean the passphrase to export the key | |
gpg --passwd $HASH | |
echo "Generating RSA keys..." | |
gpg --export-secret-keys $HASH | openpgp2ssh $HASH > id_rsa | |
chmod 400 id_rsa | |
gpg --export $HASH | openpgp2ssh $HASH > id_rsa.pub | |
echo "Cleaning up..." | |
gpg --delete-secret-key $HASH | |
gpg --delete-keys $HASH | |
rm *.key | |
echo "Success" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment