Friday, December 22, 2006

GPG Management Commands

Generates key pair:
gpg --gen-key

Lists public and private current keys:
gpg --list-keys
gpg --list-secret-keys

Exports public key / private key:
gpg --armor --export jaz@example.com
gpg --export-secret-key --armor "jaz@example.com" > private.key

Imports a public key / private key:
gpg --import joe.ca
gpg --allow-secret-key-import --import private.key

Delete public / private key:
gpg --delete-key "jaz@example.com"
gpg --delete-secret-key "jaz@example.com"

Encrypt a document with someone's public key:
gpg --output out.gpg --encrypt --recipient jaz@example.com doc
gpg -o out.gpg -e -r jaz@example.com doc

Decrypt an encrypted file:
gpg --output doc --decrypt doc.pgp
gpg -o doc --decrypt doc.pgp

Symmetric encryption:
gpg --output doc.gpg --symmetric doc
gpg -o doc.gpg -c doc

No comments: