GnuPG is an open source OpenPGP implementation.
The following will prompt for a full name and email address. The resulting key will be stored in the trust DB.
Public keys can be shared to verify signatures and allow encrypting files for only your consumption:
gpg --output public.key --armor --export some@email
Private keys should be exported only if the key was generated for the purpose of authentication on another system, or for backup:
gpg --output private.key --armor --export-secret-key some@email
Regardless of public/private, it's always just
gpg --import public.key gpg --import private.key