Page 1 of 1

decrypting data with "3DES-CBC" mode?

Posted: Tue Sep 16, 2008 1:58 am
by paasikivenpieru
Im trying to decrypt a data with PHP mcrypt_decrypt function. In the encrypted data, "tag_pin_example.enc", vector IV is set to zeroes.

I haven't work much with php and crypting, thats why I don't know to way how to 3DES-CBC works and what is the vector IV, but I still need to decrypt this file tag_pin_example.enc and make a decrypt generator for files likes that.


Here is my "brilliant" piece of code:

Code: Select all

 
<?php
//include 'todec.php';
 
$inputFile = file("c:\\works\\debug\\kryptaus\\stralfors_pin\\tag_pin_example.enc");
$key = "e1206e7240901c1a8111d077877a81ed";
 
//$size = mcrypt_get_iv_size(MCRYPT_CAST_256, MCRYPT_MODE_CFB);  //i was jus trying to set vector IV
//$iv = mcrypt_create_iv($size, 0);
 
$decryptedData = mcrypt_decrypt(MCRYPT_3DES, $key, $inputFile,MCRYPT_MODE_CBC);
 
?>
 
The command prompt says: The size of key is too large for this algothrithm(It should be right size....i dont know).
And gives a warning: Attempt to Use an empty IV, which is NOT recommend in c:\pla pla pla..