Satish B. SettyArchiveAboutRSS Feed

Quick guide to GPG

A quick ref for using GPG.

Generating keys

Choose RSA–2048 or higher.

gpg --expert --gen-key

It’s recommended to set an expiry date (you can always extend it later without affecting your key fingerprint).


In all the examples below, you can leave out --local-user and GPG will choose the best (sub-)key from your defaults. To force GPG to use a particular key you must append an exclamation point!

gpg --sign message.txt
gpg --armor --sign --local-user=213ED790! message.txt
gpg --detachsign message.txt

If you pass --armor it will generate both the signature file (*.sig) as well as the ASCII output (*.asc)

gpg --clearsign --local-user=213ED790! --no-version --comment "URL:" message.txt