Hi gang,
I know this turned into a somewhat extensive tutorial with plenty of dry theory. You can skip to the second part which will solely focus on the technical aspects (security/pks). If you didn't notice already: I'm a big fan of GnuPG / OpenPGP so yeah...
(brief) PGP history
Around 1997 Phil Zimmerman took the world by storm when he released his Pretty Good Privacy ("PGP") software. It literally took the community by storm, where the whole thing became legendary when Phil discovered a loophole in the US encryption export regulation. Although it is not permitted for a US citizen (or company) to export (strong) encryption models from the US it was allowed to use these within literature. Books. And so Zimmerman faxed the source code of his program to Europe after which we soon got 2 PGP versions: the "classic" and PGPi ('international') which provided stronger encryption schemes.
OpenPGP / GnuPG ('GPG')
A lot happened and eventually Zimmerman sold the rights for PGP to Symantec which, obviously, quickly tried to monetize the whole thing. Which, in my opinion, was basically the beginning of the end for PGP. Although you could still get the commandline versions for free (more or less) the more popular native Window versions (which provided a GUI for easier usage) were now provided as commercial software.
However... Soon the OpenPGP working group was formed which pushed for setting up a standard based on PGP. Thus RFC4880 was created, and much open source projects have been using this standard, amongst which GnuPG.
So what is this PGP / GPG / OpenPGP all about?
Encryption. As well as identity management, file / data signing and even authentication. So basically providing users with relatively easy access to strong encryption methods and more. OpenPGP is fully based on the so called public key principle. Meaning so much that users create a keypair: a public and private key. The public key can be shared as much as possible thus allowing others to use this key, for example to encrypt data. Data which is encrypted using a public key can then only be decrypted using the associated private key.
Of course there's more. It is also possible to create signatures. Signing is done using a private key and the signature validity can then be checked against the associated public key. You can think of a signature as some kind of CRC checksum, where the main difference is that instead of relying on an hash algorithm such as MD5 you're utilizing a public-key cryptosystem such as RSA.
(public) Key management
The public key principle allows you to more or less rule out a man in the middle attack. By sharing my public key I can provide you with a way to send me something in private. After all: only my private key will be able to decrypt something which was encrypted using my public key. But how can you be sure that a certain public key you're looking at is actually mine?
Fingerprints. First there's a key ID. Mine being AEA05348. But an ID can only get you so far, and so there's also a fingerprint available. Call it a CRC checksum for the key
An example of such a fingerprint could be: D1ED0FB32918FD44870794656B252E09AEA05348 (which, you might have guessed, is also mine). So all that's left to do to fully establish my identity is to exchange such information (ID's and fingerprints) through (more) secure channels (a phone call, SMS message, instant messaging, a forum PM, etc.).
But this doesn't address another problem: how to easily obtain my public key. Sure, I could simply dump it into this message (or as an attachment, which I did) but then you could have quite a hassle on your hands. What if you're currently using a desktop computer yet want to use this public key on your FreeBSD server for verification purposes? Maybe SSH / PuTTY can help you out (pscp.exe for example) but surely we can do better?
This is where the OpenPGP public keyservers come into play, the most commonly used being keys.gnupg.net. Keyservers provide us with an easy way to utilize the HKP protocol (based on HTTP) to upload, query and retrieve specific public keys. So far, so good. All it takes is a (partial) name or key-id and GPG (or a graphical frontend such as Kleopatra) can do the rest.
But there is a problem... What is uploaded to a keyserver usually remains on that keyserver. Forever. Try looking up lion-o@neko-net.org. A key generated in 2005, revoked, yet still available. Sometimes that is simply unwanted behavior.
Or... what to think about using company keys on a public keyserver? All it takes is one "smart" end user who decides to look up an admin's name or e-mail address on said keyserver and before you know you'll get 1st line support questions in your 3rd line support mailbox. That's no good...
The solution? Simple: set up your own (private) keyserver. The FreeBSD ports collection provides an easy way to do this with security/pks which I'll explain in the next part.
I know this turned into a somewhat extensive tutorial with plenty of dry theory. You can skip to the second part which will solely focus on the technical aspects (security/pks). If you didn't notice already: I'm a big fan of GnuPG / OpenPGP so yeah...

(brief) PGP history
Around 1997 Phil Zimmerman took the world by storm when he released his Pretty Good Privacy ("PGP") software. It literally took the community by storm, where the whole thing became legendary when Phil discovered a loophole in the US encryption export regulation. Although it is not permitted for a US citizen (or company) to export (strong) encryption models from the US it was allowed to use these within literature. Books. And so Zimmerman faxed the source code of his program to Europe after which we soon got 2 PGP versions: the "classic" and PGPi ('international') which provided stronger encryption schemes.
OpenPGP / GnuPG ('GPG')
A lot happened and eventually Zimmerman sold the rights for PGP to Symantec which, obviously, quickly tried to monetize the whole thing. Which, in my opinion, was basically the beginning of the end for PGP. Although you could still get the commandline versions for free (more or less) the more popular native Window versions (which provided a GUI for easier usage) were now provided as commercial software.
However... Soon the OpenPGP working group was formed which pushed for setting up a standard based on PGP. Thus RFC4880 was created, and much open source projects have been using this standard, amongst which GnuPG.
So what is this PGP / GPG / OpenPGP all about?
Encryption. As well as identity management, file / data signing and even authentication. So basically providing users with relatively easy access to strong encryption methods and more. OpenPGP is fully based on the so called public key principle. Meaning so much that users create a keypair: a public and private key. The public key can be shared as much as possible thus allowing others to use this key, for example to encrypt data. Data which is encrypted using a public key can then only be decrypted using the associated private key.
Of course there's more. It is also possible to create signatures. Signing is done using a private key and the signature validity can then be checked against the associated public key. You can think of a signature as some kind of CRC checksum, where the main difference is that instead of relying on an hash algorithm such as MD5 you're utilizing a public-key cryptosystem such as RSA.
(public) Key management
The public key principle allows you to more or less rule out a man in the middle attack. By sharing my public key I can provide you with a way to send me something in private. After all: only my private key will be able to decrypt something which was encrypted using my public key. But how can you be sure that a certain public key you're looking at is actually mine?
Fingerprints. First there's a key ID. Mine being AEA05348. But an ID can only get you so far, and so there's also a fingerprint available. Call it a CRC checksum for the key

But this doesn't address another problem: how to easily obtain my public key. Sure, I could simply dump it into this message (or as an attachment, which I did) but then you could have quite a hassle on your hands. What if you're currently using a desktop computer yet want to use this public key on your FreeBSD server for verification purposes? Maybe SSH / PuTTY can help you out (pscp.exe for example) but surely we can do better?
This is where the OpenPGP public keyservers come into play, the most commonly used being keys.gnupg.net. Keyservers provide us with an easy way to utilize the HKP protocol (based on HTTP) to upload, query and retrieve specific public keys. So far, so good. All it takes is a (partial) name or key-id and GPG (or a graphical frontend such as Kleopatra) can do the rest.
But there is a problem... What is uploaded to a keyserver usually remains on that keyserver. Forever. Try looking up lion-o@neko-net.org. A key generated in 2005, revoked, yet still available. Sometimes that is simply unwanted behavior.
Or... what to think about using company keys on a public keyserver? All it takes is one "smart" end user who decides to look up an admin's name or e-mail address on said keyserver and before you know you'll get 1st line support questions in your 3rd line support mailbox. That's no good...
The solution? Simple: set up your own (private) keyserver. The FreeBSD ports collection provides an easy way to do this with security/pks which I'll explain in the next part.