Encrypting files with GPG

So I heard that you want to encrypt some files before sending them to your friends? Indeed you should! As we all know, plaintext networks are dangerous places, and actually, anyone out there shuffling your traffic around the series of tubes may be able to intercept what you send and receive. This tutorial will explain some basics about how to turn your files into next level encrypted files.

Since you have already worked your way around the GPG-tutorial, it is now time to get down to encrypting files. Your computer may be lost or stolen, which means that encrypting the data is a good plan. Also, GPG is very clever. Not only can you encrypt files for yourself, but also for your friends!

Lets begin with this fictional diary of mine. I have written it in plaintext using the program nano, which is an averate text editor. However, this little text file can be replaced with any type of data; images, videos, sound files, even multiple files that you add to a compressed archive.

Then I encrypt the file deardiary.txt with the commands gpg -e -s deardiary.txt. The -e means to encrypt, and the -s means to sign it with your identity. Then you give your secret passphrase and plaintext has been made into ciphertext.

Now you have a new file called deardiary.txt.gpg which looks like this if you try to read it. Yes, this what ciphertext looks like. Only I can decrypt this file!

However, lets say I want my friend Karin to be able to read my secret diary? Now comes the clever thing with GPG. If I use her key, which I have signed and stored on my computer since she is in my web of trust, I can simply choose to encrypt the file so that only she is able to decrypt it. This way, I can e-mail her the file without anyone but her being able to read it. I can even upload it to this page, like here maybe, it doesn't matter because her key is the only thing that opens it.

Trying to read it, well, you are busted again with ciphertext.

To decrypt a message, you simply write gpg -d deardiary.txt.gpg. Then ciphertext is made into plaintext again.

If you have a long file, however, you don't want to just print it on your screen. So instead you can make a new plaintext file with gpg -d deardiary.txt.gpg >deardiary.txt and the plaintext will appear in a new file.

Stay safe, stay in cipher!