Difference between gpg and pgp Pretty Good Privacy GNU Privacy Good?

Public key (lock) + private key (unlock) address of mailbox (public) + mailbox key (private) asmetric encryption

two pairs required (private + public)(sender + receiver)

encryption authentication integrity

To generate a key using gpg:

gpg --gen-key

This will prompt for a name and email address, as well as a passphrase to encrypt the private key. The --armor flag is used to convert the binary format in which data is stored to base64 encoded text.

To print the public key:

gpg --armor --export name

Where name is the name provided when generating the key. This will print the public key in ascii.

To decrypt some text, provide the filename or pipe the text directly:

echo "-----BEGIN PGP MESSAGE----- ..." | gpg --decrypt

This automatically selects the correct key and prompts for the passphrase to decrypt the private key.

To encrypt some text, pipe the text directory or provide the filename:

gpg --encrypt --armor -r recepient-name filename

Where recepient-name is the user ID of the key and filename is the name of the file to encrypt.

Encryption can also be done without public/private keys:

echo "Hello" | gpg --symmetric --armor --passphrase "secret-passphrase"