Table of Contents

Gnu Privacy Guard

Generate a private/public key pair

gpg --gen-key

(Optional) Keyserver Registration

To enable someone to retrieve your public key without having to contact you directly.

Find the id/fingerprint

gpg --fingerprint <your name used in generation above>

id is the hex digit string after the / on the line starting with “pub” fingerprint is the 10 groups of 4 hex digits on the “fingerprint” line!

Register with a key server

There are many available. This is just one example.

gpg --keyserver subkeys.pgp.net --send-keys '<id>'
or
gpg --keyserver subkeys.pgp.net --send-keys '<fingerprint>'

Either method works.

Decrypt a file using your (stored) private key

gpg --decrypt --output /tmp/<readable file> <encrypted file>
or
gpg -d -o /tmp/<readable file> <encrypted file>

List the public keys on your keyring

gpg --list-keys

List the private key on your keyring

[[oracle@sdtcsynx4adb01 ~]]$ gpg --list-secret-keys --keyid-format LONG
/home/oracle/.gnupg/secxxxx.gpg
-------------------------------
sec   1024D/xxxx78D9BC15EC4B 2014-09-23
uid                          xxxxsynxxxxx01 (xxxxxxxx xxxx) <[email protected]>
ssb   1024g/6592B7C56EEBBB8A 2014-09-23

Use the private key on your keyring to display public key

gpg --armor --export xxxx78D9BC15EC4B
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.14 (GNU/Linux)

mQGiBFQhW3URBADY5RfOofl4/8tA+FN2zbVFAHV5hzI8vQA8wmAC9GV3B4HR6xYC
5qBQPANhFgi9Atw+b/E/3Cs2+g5MfLwOvglxa5cOgbvYMohu80qOz/lXsVHNaaco
n1FPTswudXca6h85QOu1tPj/3Y+bW+QaZS+SddMCv3KM5fxOUbaTRTIWUwCg56Jd
FZEuDM7jFljyJE3lwDlcdo0EAIClPqBLCXXE3ZyJjNrcMyaqm8bNWyifjq5ZhXBU
...
lFx+IJyA791gruhSecKmcQHcruOrinrvXiS4OULNSbOlmuB+KsaVLAA3clpNI30Y
ph1CEgBka0N1nLl/8qN3XTaSydx7DbYZCwW5TMEmWj8z8K3QQ5njeGPXTtmISQQY
EQIACQUCVCFbdQIbDAAKCRCZMXjZvBXsS9TqAKDCqDwvFE+gKtHv5Wc3DTSPjIUf
vACcCZB+Z0p4SV/Js+MSHU1ewntB4CU ======
====== QKiI
-----END PGP PUBLIC KEY BLOCK-----

Delete someones public key from your keyring

gpg --list-secret-keys
gpg --armor --output pubic_gpg_key.txt --export '<your name used in generation above>'

Change information about the key

gpg --refresh-keys