- install pgpdump util for viewing the PGP keys.
- import PGP keys into a custom private key ring: The public and private are both in private.pgp
- gpg –import –no-default-keyring –keyring /tmp/public –secret-keyring /tmp/private private.pgp
- list secret keys in a non default ring:
- gpg -K –secret-keyring /tmp/private
- list keys in default public and secret rings:
- gpg -K, gpg -k
A script
# import the public and private key pair prior to the encryption
gpg –import –no-default-keyring –secret-keyring ${SECRET_KEYRING} ${PRIVATE_KEY}
chmod 400 ${SECRET_KEYRING} ${PRIVATE_KEY} ${PASSPHRASE}
# decrypt
cd ${input_dir}
for pgp_file in *.gpg
do
unenc_file=${pgp_file%.gpg}
gpg –secret-keyring ${SECRET_KEYRING} –batch –output ${output_dir}/${unenc_file} –passphrase-fd 0 $pgp_file < ${PASSPHRASE}
done