gpg cheatsheet

  • 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

Advertisements
This entry was posted in gpg. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s