Что-то вот такое вам нужно:
<?php
function pkcs5_pad ($text)
{
$size = mcrypt_get_block_size (MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
$pad = $size - (strlen($text) % $size);
return $text . str_repeat(chr($pad), $pad);
}
function pkcs5_unpad ($text)
{
$pad = ord ($text{strlen ($text) - 1});
if ($pad > strlen ($text))
return false;
if (strspn($text, $text{strlen($text) - 1}, strlen($text) - $pad) != $pad) {
return false;
}
return substr($text, 0, -1 * $pad);
}
$key = '140b41b22a29beb4061bda66b6747e14';
$enc = '4ca00ff4c898d61e1edbf1800618fb2828a226d160dad07883d04e008a7897ee2e4b7465d5290d0c0e6c6822236e1daafb94ffe0c5da05d9476be028ad7c1d81';
$iv = substr ($enc, 0, 32);
$enc = substr ($enc, 32);
$iv = hex2bin ($iv);
$enc = hex2bin ($enc);
$key = hex2bin ($key);
$dec = mcrypt_decrypt (MCRYPT_RIJNDAEL_128, $key, $enc, MCRYPT_MODE_CBC, $iv);
$dec = pkcs5_unpad ($dec);
echo "$dec\n"; /* Basic CBC mode encryption needs padding. */