GNU Privacy Guard (GPG/PGP) for encrypting messages by using PKI or asymmetric keywhich is a mechanism uses public and private key.
sender side
public key use to encrypt message to send it. receiver side
private key use to decrypt encrypted message. Owner of the keys can exchange public key with others , and then they send back encrypted messages again to the owner (message encrypt by public key and decrypt by private key), and as usual private key must be secured well.
Encryption and Decryption We now try to encrypt messages or text file by using GPG, for example i have a file (example.txt) contain
Testing GPG encryption 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Let’s encrypt it with my public key, let’s list our keys by command gpg --list-key
pub 2048R/55728FBB 2010-11-20 uid example <[email protected]> sub 2048R/5A5F62F0 2010-11-20 We will encrypt example.