How to cypher/encrypt files with GPG

The cloud is an important part of our lifes now, and allow us save space. But there is a problem... How can you be so convinced that your data is really secure there? 

Services like Dropbox (for example) can tell us that they protect our privacy and that nothing bad will happen... But how can you be sure if you do not have the source code? Then we have the option of "trust" only because they say, well, that does not work.

So, I will explain how can you upload files or something to the cloud, in a safe way.

First, you must edit the ~/.gnupg/gpg.conf file to use AES256, so put: cipher-algo AES256

Let's do it, creating an Encrypted File
Both commands below are identical. They encrypt the file "test.out" and produce the encrypted version in "test.gpg."
$ gpg --output test.gpg --symmetric test.out

$ gpg -o test.gpg -c test.out
You will be prompted for a passphrase, which will be used later to decrypt the file.
Decrypting a File
The following command decrypts the file "test.gpg" and produces the file "test.out."
$ gpg --output test.out -d test.gpg 
You will be prompted for the passphrase that you used to encrypt the file. If you don't use the --output option, output of the command goes to STDOUT. If you don't use any flags, it will decrypt to a file without the .gpg suffix. That is:
$ gpg test.gpg 
Results in the decrypted data in a file named "test". Now you can do the same with another files, like rar, zip, pictures...
And then, upload to the cloud :)

Post a Comment

Previous Post Next Post