RSS

Category Archives: decrypt

Decrypting Multiple Files with GnuPG

>Here’s a simple UNIX/Linux script that asks for a password and then decrypts a batch of files using that password, using GnuPG:

#!/bin/bash

echo -n "Enter password: "
stty -echo
read password
stty echo

for encrypted in *.gpg; do
decrypted=`echo ${encrypted} | sed s/.gpg\$//`
echo -n ${decrypted}
echo "${password}" | gpg --passphrase-fd 0 -o "${decrypted}" -d "${encrypted}" > /dev/null 2> /dev/null
if [ "$?" = "0" ]; then
chmod 600 "${decrypted}"
echo " [ DONE ]"
else
echo " [ FAILED ]"
fi
done
Advertisements
 
1 Comment

Posted by on 22 April 2009 in decrypt, decryption, gnupg, password