Quick Tutorial: How to encrypt files using public keys with gpg
This tutorial covers how to encrypt files using public keys with gpg. If you have not created key pairs yet, Click Here to know the steps of generating key pairs using gpg. I assume you have created key pairs, now below are the steps that need to be followed:
(1) Extract public keys and save them in the current directory
cd .gnupg
gpg --
export -a -o user-public-key.txt
(2) Share public keys with another user via mail
A public key is no secret and can be shared via email or any other electronic means. Other users encrypt it by using the public key.
gpg -s -e test.txt
(3) Now decrypt it with the private key
gpg -d test.txt.gpg
Conclusion
This is a quick tutorial to know how to encrypt files using public keys with gpg. You may refer to another tutorial in which you can sign data and verify it using gpg.
Subscribe us to receive more such articles updates in your email.
If you have any questions, feel free to ask in the comments section below. Nothing gives me greater joy than helping my readers!
Disclaimer: This tutorial is for educational purpose only. Individual is solely responsible for any illegal act.