29
loading...
This website collects cookies to deliver better user experience
Note: this post is the second in a 2-part series aimed at developing a functional use of GPG for the day-to-day tasks of anyone who cares about software. Check out Part 1 to learn about signing and verifying signatures.
There is much more to learn about privacy, encryption, and GPG than I cover in this series; for information on who invented this whole thing in the first place, check out Phil Zimmermann's Wikipedia page; for more on the difference between GPG and PGP, check out this article; to dig deeper into the specifics of GPG, check out their docs.
message.txt
in a way that only Morpheus will be able to decrypt it, we first check that his key in our keyring, then use the --encrypt
command like so:# check for the recipient's info in your keyring
# the second key here is our friend Morpheus' key we just imported
$ gpg --list-keys
pub rsa1024 2019-09-14 [SC]
0E94A26389C660DFE8C2F31705D085D9893479A7
uid [ultimate] MrAnderson <[email protected]>
sub rsa1024 2019-09-14 [E]
pub rsa1024 2019-09-14 [SC]
5F357B756A571BF8A88567AF06898DFB48E3D899
uid [ full ] Morpheus <[email protected]>
sub rsa1024 2019-09-14 [E]
# produce the encrypted file message.txt.asc
$ gpg --encrypt --armor -r Morpheus message.txt
# print message to console
gpg --decrypt message.txt.asc
# send message to file
gpg --decrypt message.txt.asc > decryptedMessage.txt
gpg --help
!29