fugu Posted December 31, 2015 Share Posted December 31, 2015 I hope anyway! I put together 2 scripts to make it easy to pipe strings into/out of gpg from the commandline and I have found it useful $ cat ./encrypt.sh #!/bin/bash cat - | gpg --encrypt -r $(gpg --list-secret-keys | grep '^sec ' | head -n 1 | cut -d\ -f4 | cut -d/ -f2) and $ cat ./decrypt.sh #!/bin/bash TEMPFILE=$(tempfile) exec 3<> $TEMPFILE cat - >&3 zenity --password --title="Passphrase" --cancel-label="Skip" | gpg --no-tty --passphrase-fd 0 --decrypt -q --no-use-agent $TEMPFILE if [ -x $(which shred) ]; then shred -z -n 6 -u $TEMPFILE; else rm -f $TEMPFILE; fi unset TEMPFILE exec 3>&- So you should be able to do things like: $ echo 'Hello World' | ./encrypt.sh > encfile.bin $ cat encfile.bin | ./decrypt.sh Hello World I've tested it somewhat and it seems to work well. But it might not work well if you system has more then onesecret key on it, cause it uses the first public/secret key pair it finds in your gpg keyring. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.