This site has been moved to “requesttutorial.com“
This is my Second tutorial on Encryption in Linux, This time we will be encrypting individual files. The tools we will be using are gpg2 and openssl. Both of these tools are installed by default and part of almost every Linux distribution.
So Lets Get Started
Operating System: Fedora 14 (I am going to Upgrade to Fedora 17 in a day or two :p)
User: root (I know I know, but its just for sake of learning and I hate typing sudo with every command)
Encryption Tools: gpg2 and openssl (If these are not already installed, use synaptic manager or add/remove, depending on your distribution)
Encrypting using GPG2:
1. Encrypting Files using gpg2 is extremely simple, just open a terminal and type the following command
#gpg2 -c myfile
2. gpg2 will prompt you for a passphrase in a nice graphical environment, Enter it and confirm it.
3. And that’s that, its encrypted, the file will get an extension of .gpg which indicates that this is encrypted file (using gpg2).
1. To decrypt a file just simply double click on it and it will prompt you for that passphrase, Enter it and you will get a decrypted copy of the file.
2. You can also decrypt a file using the following command
#gpg2 -d myfile.gpg
3. Enter the passphrase and you are done
Encrypting using Openssl:
1. To encrypt a file using openssl, using the following command
#openssl aes-128-cbc -in myfile -out myfile_encrypted
2. Simply enter the passphrase and the file is encrypted
3. aes-128-cbc is our encrypting algorithm, if you want to encrypt it with another algorithm, check the help of openssl for list of algorithms supported by openssl
1. To decrypt the files, use the following command
#openssl enc -d -in myfile_encrypted -out myfile
2. You will be prompted for a passphrase, simply enter it and that’s it.
Please leave your questions, suggestions and comments in comment Section.