GNU Privacy Guard.

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

# To encrypt doc.txt for (output to doc.txt.gpg):
gpg --encrypt --recipient <> <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 (output to 'stdout'):
gpg --export --armor <>

# To export private key for (output to 'stdout'):
gpg --export-secret-keys --armor <>