How to encrypt and dycrypt file with passphrase.
DESCRIPTION
Mcrypt is a simple crypting program, a replacement for the old unix crypt(1). When encrypting or ecrypting a file, a new file is created with the extension .nc and mode 0600. The new file keeps the modification date of the original. The original file may be deleted by specifying the -u parameter. If no files are specified, the standard input is encrypted to the standard output.
Encrypt
sahab@sahab:~$ sudo mcrypt -uz testing
Enter the passphrase (maximum of 512 characters)
Please use a combination of upper and lower case letters and numbers.
Enter passphrase:
Enter passphrase:
File testing was encrypted.
sahab@sahab:~$ ls
testing.gz.nc
Decrypt
sahab@sahab:~$ sudo mcrypt -d testing.gz.nc
Enter passphrase:
File testing.gz.nc was decrypted.
sahab@sahab:~$ mcrypt --help
Mcrypt encrypts and decrypts files with symmetric encryption algorithms.
Usage: mcrypt [-dFusgbhLvrzp] [-f keyfile] [-k key1 key2 ...] [-m mode] [-o keymode] [-s keysize] [-a algorithm] [-c config_file] [file ...]
-g, --openpgp Use the OpenPGP (RFC2440) file format.
--openpgp-z INTEGER Sets the compression level for openpgp
packets (0 disables).
-d, --decrypt decrypts.
-s, --keysize INTEGER Set the algorithm's key size (in
bytes).
-o, --keymode KEYMODE Specify the keyword mode. Use the
--list-keymodes parameter to view all
modes.
-f, --keyfile FILE Specify the file to read the keyword
from.
-c, --config FILE Use configuration file FILE.
-a, --algorithm ALGORITHM
Specify the encryption and decryption
algorithm. Use the --list parameter to
see the supported algorithms.
--algorithms-directory DIRECTORY
Set the algorithms directory.
-m, --mode MODE Specify the encryption and decryption
mode. Use the --list parameter to see
the supported modes.
--modes-directory DIRECTORY
Set the modes directory.
-h, --hash HASH Specify the hash algorithm to be used.
Use the --list-hash parameter to view
the hash algorithms.
-k, --key KEY1 KEY2...KEYN
Specify the key(s)
--noiv Do not use an IV.
-b, --bare Do not keep algorithm information in
the encrypted file.
-z, --gzip Use gzip to compress files before
encryption.
-p, --bzip2 Use bzip2 to compress files before
encryption.
--flush Immediately flush the output
-l, --doublecheck Double check passwords.
-u, --unlink Unlink the input file after encryption
or decryption.
--nodelete Do not delete the output file if
decryption failed.
-t, --time Prints timing information.
-F, --force Forces output to stdout.
--echo Echo asterisks when entering the
password.
-r, --random Use real random data (if your system
supports it).
--list Prints a list of the supported
algorithms and modes.
--list-keymodes Prints a list of the supported key
modes.
--list-hash Prints a list of the supported hash
algorithms.
-V, --verbose More information is displayed.
-q, --quiet Suppress some non critical warnings.
--help Prints this help
-v, --version Prints the version number
-L, --license Displays license information.
Report bugs to mcrypt-dev@lists.hellug.gr.
No comments:
Post a Comment