Last active
May 26, 2018 21:51
-
-
Save T31337/90de98dc4428832938e0de8f4f30fc19 to your computer and use it in GitHub Desktop.
gpg helper functions script
This file contains hidden or 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 -e "\n" | |
echo -e "===========" | |
echo -e "GPG HELEPR" | |
echo -e "==========" | |
genKey() | |
{ | |
clear | |
echo -e "Generate New GPG Key...\n" | |
#Generate New GPG Key | |
gpg --full-generate-key | |
} | |
listSecretKey() | |
{ | |
#List gpg keys | |
clear | |
echo -e "Secret GPG Keys:\n" | |
gpg --list-secret-keys --keyid-format LONG | |
} | |
printKey() | |
{ | |
# Prints the GPG key, in ASCII armor format | |
clear | |
echo -e "GPG Keys (ASCII ARMOR FORMAT)\n" | |
echo -e "------------------------------------\n" | |
gpg --armor --export | |
} | |
SignTag() | |
{ | |
echo -e "GIT Tagging\n" | |
echo -e "--------------\n" | |
#sign tag | |
git tag -s mytag | |
#verify tag | |
git tag -v mytag | |
} | |
backupKeys() | |
{ | |
echo -e "Backing Up GPG Keys...\n" | |
echo -e "------------------------\n" | |
#Backup Keys! | |
cp -R ~/.gnupg/ ~/gnupg_backup | |
} | |
restoreKeys() | |
{ | |
echo -e "Restoring GPG Keys...\n" | |
echo -e "-----------------------\n" | |
#Restore Keys! | |
#incase a folder exists, it will be moved to ~/.gnupg.old | |
if [[ -d ~/.gnupg ]]; then | |
mv ~/.gnupg ~/.gnupg.$(date "+%y%m%d%H%M%S").old; | |
fi | |
mv ~/gnupg_backup ~/.gnupg | |
echo -e "\n\nDone!\n" | |
} | |
if [ ! $@ ]; then | |
clear | |
echo | |
echo -e "-GPG Helper-" | |
echo -e " Functions" | |
echo -e "------------\n" | |
echo -e " genKey\n listSecretKey\n printKey\n configureGit\n SignTag\n backupKeys\n restoreKeys\n" | |
echo -e "***************************\n" | |
else | |
$1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FIXED ERROR: Using$1 VS $ @