PGP Examples
Examples for MacOS, Windows and Linux.
Generate a key pair
$ gpg --gen-key
$ gpg -k # list keys
Export keys
$ gpg --output "my public.key" --export -a email@example.com
$ cat "my public.key"
$ gpg --output "my private.key" --export-secret-key -a email@example.com
$ cat "my private.key"
Remember that the private key is a secret and should not be published.
Encrypt and decrypt files
$ gpg --encrypt --sign -r email@example.com secretMessage.txt
$ ls secretMessage.txt.gpg
$ rm -f secretMessage.txt
$ gpg --output secretMessage.txt --decrypt -r email@example.com secretMessage.txt.gpg
$ cat secretMessage.txt
Find out MORE about PGP and computer security HERE.