I have a problem decrypting a string in ASP.NET wich was encrypted at PHP. As a testcase, i tried to encrypt 'test' in ASP.NET and in PHP, using 3DES in cbc mode. But the encrypted values don't match :(. I want the values to match, so i know for sure i use the same encryption method. Please help me on this, I just don't understand how there are different values...
Here's the code i use in php:
$cc = "test";
$key = pack("c*", 0x13, 0x56, 0x23, 0x15, 0x81, 0x28, 0x56, 0x51, 0x13, 0x56, 0x23, 0x15, 0x81, 0x28, 0x56, 0x52, 0x13, 0x56, 0x23, 0x15, 0x81, 0x28, 0x56, 0x51);
$iv = pack("c*", 0x42, 0x32, 0x84, 0x25, 0x79, 0x43, 0x11, 0x37);
//PADDING THE TEXT.
$block = mcrypt_get_block_size('tripledes', 'cbc');
$len = strlen($cc);
$padding = $block - ($len % $block);
$cc .= str_repeat(chr($padding),$padding);
$cipher = mcrypt_module_open(MCRYPT_3DES,'','cbc','');
mcrypt_generic_init($cipher, $key, $iv);
$encrypted = mcrypt_generic($cipher,$cc);
View Complete Post