Skip to main content

GNU Privacy Guard. See gpg2 for GNU Privacy Guard 2.

# To create a GPG public and private key interactively:
gpg --full-generate-key

# To sign 'doc.txt' without encryption (writes output to 'doc.txt.asc'):
gpg --clearsign <doc.txt>

# To encrypt 'doc.txt' for alice@example.com (output to 'doc.txt.gpg'):
gpg --encrypt --recipient <alice@example.com> <doc.txt>

# To encrypt 'doc.txt' with only a passphrase (output to 'doc.txt.gpg'):
gpg --symmetric <doc.txt>

# To decrypt 'doc.txt.gpg' (output to stdout):
gpg --decrypt <doc.txt.gpg>

# To import a public key:
gpg --import <public.gpg>

# To export public key for alice@example.com (output to stdout):
gpg --export --armor <alice@example.com>

# To export private key for alice@example.com (output to stdout):
gpg --export-secret-keys --armor <alice@example.com>