Skip to content

Instantly share code, notes, and snippets.

@chnirt
Created May 9, 2022 06:38
Show Gist options
  • Save chnirt/32e43818a340c844938ee78b994adaa0 to your computer and use it in GitHub Desktop.
Save chnirt/32e43818a340c844938ee78b994adaa0 to your computer and use it in GitHub Desktop.
Encrypt & Descrypt by GPG
echo "Encrypt & Decrypt with PGP by Chnirt"
# install gpg
# https://gpgtools.org/
# gpg --full-generate-key
choice="Encrypt Decrypt Exist"
select option in $choice
do
echo "$option"
case $option in
Encrypt)
echo "Please enter the filename you want to encrypt"
read inputFile;
echo "Please enter the filename you want to generate"
read outputFile;
gpg --encrypt --output "$outputFile.gpg" --recipient trinhchinchin@gmail.com $inputFile
break
;;
Decrypt)
echo "Please enter the filename you want to encrypt"
read inputFile;
echo "Please enter the filename you want to encrypt"
read outputFile;
gpg --decrypt --output $outputFile $inputFile
break
;;
*)
break
;;
esac
done
# See more
# https://itsfoss.com/gpg-encrypt-files-basic/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment