I'm trying to use function that decrypt for me ciphertext after encrypted using Objective-C
I know that the problem is in padding.
so I found this function form this site.
thanx for the guy posted.
function decrypt_password($pass,$key)
{
$base64encoded_ciphertext = $pass;
$res_non = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, base64_decode($base64encoded_ciphertext), ‘ecb’);
$decrypted = $res_non;
$dec_s2 = strlen($decrypted);
$padding = ord($decrypted[$dec_s2-1]);
$decrypted = substr($decrypted, 0, -$padding);
return $decrypted;
}
The result I found is this:
Notice: Use of undefined constant ‘ecb’ - assumed '‘ecb’' in C:\wamp\www\enc3.php on line 7
Warning: mcrypt_decrypt() [function.mcrypt-decrypt]: Module initialization failed in C:\wamp\www\enc3.php on line 7
Can any one help to make the code work greatly since i need it with same result to use it in decrypt the recived ciphertext from Objective-C?
by the way I use wamp server 2.0 that support mcrypt function.