By default Linux systems do not ship with the mcrypt utility. At least not CentOS or Ubuntu that is.
In Ubuntu installing mycrypt is just a matter of running the following command:
apt-get install mcrypt
In CentOS 5.5 mycrypt is not included in the distribution’s repositories because when I ran yum install mcrypt
it installed the php-mcrypt packages along with the libmcrypt and libmcrypt-devel. But it didn’t actually included the actual mcrypt userland application. This meant I had to install the package from source. Installing mcrypt from source required an additional library called mhash to be installed. After that dependency was installed then it was just a matter of executing the following commands to install mcrypt:
./configure
make
make install
Once installed then, encrypting a file can be done with the following command:
mcrypt filetoencrypt
Mcrypt will prompt you for a secret keyphrase to use to decrypt the file.
Mcrypt creates the encrypted file with a .nc enxtension. To decrypt the file simply run the following command:
mcrypt -d filetoencrypt.nc
If you don’t want to specify your secret passphrase every time you encrypt/decrypt a file, you can create a user mcrypt config file on ~/.mcryptrc with the following contents in it:
key yourultrasecurepassphrasehere
http://sourceforge.net/projects/mcrypt/
Dependency:
http://mhash.sourceforge.net/