Encriptació amb mcrypt

De wikijoan
Salta a la navegació Salta a la cerca
sudo apt-get install mcrypt

MCRYPT(1)                                                                                                                             MCRYPT(1)

NAME
       crypt, mcrypt, mdecrypt - encrypt or decrypt files

SYNOPSIS
       mcrypt [ -dLFubhvrzp ] [-a algorithm] [-c config_file] [-m mode] [-s keysize] [-o keymode] [-k key1 key2 ...]  [-f keyfile] [ filename ...  ]


per executar la comanda key és necessari:
sudo apt-get install donkey

man key
DONKEY(1)
NAME
       donkey - alternative for S/KEY's "key" command.

SYNOPSIS
       donkey [options] sequence seed
       donkey -i

       key [option] sequence seed
       key -i


$ key -i
Enter login name [default joan]: 
Enter sequence 1 to 999 [default 99]: 245
Enter new seed [default jo61051]: 
Please choose passphrase between 8 and 256 characters.
Enter passphrase : 
Re-enter passphrase : 
joan 0245 jo61051          d9dd85a1da42224c  Oct 06,2011 02:31:19
SHAG TINA COAT LURE KIN LYE


$ mcrypt -F -c ~/.mcryptrc prova.sh 
Warning: Cannot access config file.
Enter the passphrase (maximum of 512 characters)
Please use a combination of upper and lower case letters and numbers.
Enter passphrase: 
Enter passphrase: 

File prova.sh was encrypted.

S'ha generat el fitxer prova.sh.nc, i ara ja puc eliminar l'original
rm prova.sh
cat prova.sh.nc

Ara el vull desencriptar
$ mcrypt -F -d -c ~/.mcryptrc prova.sh.nc
Warning: Cannot access config file.
Enter passphrase: 
File prova.sh.nc was decrypted.

cat prova.sh